@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button sendBtn=(Button)findViewById(R.id.button1);
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent(MainActivity.this,Send.class);
startActivity(intent);
}
});
}
我在该按钮上有一个按钮单击我要打开名为Send的第二个活动,但app很不幸地停止了logcat显示如下错误:
04-07 13:39:33.040: E/AndroidRuntime(2426): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.send/com.send.Send}; have youdeclared this activity in your AndroidManifest.xml?
答案 0 :(得分:3)
转到Manifest.xml
并在Application
标记下添加此标记:
<activity
android:name="com.send/com.send.Send" >
</activity>
答案 1 :(得分:0)
1.转到您的Mainfiest.xml类并检查您是否已注册您的包..如果没有声明您的活动 例如:
<activity
android:name="package name.class name"
android:label="@string/app_name" >
</activity>
**or**
<activity
android:name=".class name"
android:label="@string/app_name" >
</activity>