我有問題要與意圖工作。調試器在最後一行之後崩潰。但是,如果我在這一行設置了一個斷點,則myVar1會被正確填充,但執行該行程序時會崩潰。謝謝。安卓與意圖工作
從主類
Intent intent = new Intent(getBaseContext(), myPush.class);
intent.putExtra("myVar1", var1);
startActivity(intent);
和myPush類
String recVar = getIntent().getExtras().getString("myVar1");
編輯:已經嘗試過用Intent(this, myPush.class)
和Intent(currentClass.this, myPush.class)
和相同的結果!
debbuger不說太多...
03-14 14:28:48.887: W/dalvikvm(2595): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
嘗試將'getBaseContext()'更改爲'this'。 – 2012-03-14 14:10:45
不應該是'String recVar = getIntent()。getExtras()。getString(「myVar1」);' – zapl 2012-03-14 14:27:02