我得到一个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;
这就是它!非常感谢你。 –
欢迎,请将此答案标记为已接受(勾号) –