我得到一個ActivityNotFoundException,當我使用此代碼:正確處理意圖解決ActivityNotFoundException
public void addListenerOnButton3(){
button3 = (Button) findViewById(R.id.btnSettings);
button3.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
Intent intentSettings = new Intent("net.stuffilike.kanaflash.Settings");
showToast("Settings clicked,");
try{
startActivity(intentSettings);
}
catch(Exception e){
showToastL("Exception" + e);
}
return;
}
});
}
不夠公平,但我不能告訴它怎麼要我告訴它的活動是。以下是清單的相關部分:
<activity
android:name="net.stuffilike.kanaflash.Settings"
android:label="@string/settings" >
<intent-filter>
<action android:name="android.intent.action.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
如何確保編譯器找到我的Settings.java文件? 哦,我的包被命名爲
package net.stuffilike.kanaflash;
這就是它!非常感謝你。 –
歡迎,請將此答案標記爲已接受(勾號) –