隐式启动activity问题, 在Manifest.xml中配好了activity,但是启动是报错说找不到
Manifest.xml中第二个activity<activityandroid:name="com.lzc.activity_ex1.Activity_01"andro...
Manifest.xml 中第二个activity
<activity
android:name="com.lzc.activity_ex1.Activity_01"
android:label="@string/app_name" >
<intent-filter>
//action 为cc.android.myAction
<action android:name="cc.android.myAction" />
<category android:name="android.intent.category.DEFALUT" />
</intent-filter>
</activity>
-------------------
java代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity_00);
Button btn = (Button)this.findViewById(R.id.btn01);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//显式启动activity,可以成功
//Intent intent =new Intent(Activity_00.this,Activity_01.class);
//隐式启动,就失败
Intent intent =new Intent();
intent.setAction("cc.android.myAction");
startActivity(intent);
}
});
}
求教,谢谢!还有哪里没考虑周到么?
报错如下:
04-27 23:20:20.948: W/dalvikvm(14761): threadid=1: thread exiting with uncaught exception (group=0x40fc9300)
04-27 23:20:20.953: E/AndroidRuntime(14761): FATAL EXCEPTION: main
04-27 23:20:20.953: E/AndroidRuntime(14761): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=cc.android.myAction }
省略一部分 展开
<activity
android:name="com.lzc.activity_ex1.Activity_01"
android:label="@string/app_name" >
<intent-filter>
//action 为cc.android.myAction
<action android:name="cc.android.myAction" />
<category android:name="android.intent.category.DEFALUT" />
</intent-filter>
</activity>
-------------------
java代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activity_00);
Button btn = (Button)this.findViewById(R.id.btn01);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//显式启动activity,可以成功
//Intent intent =new Intent(Activity_00.this,Activity_01.class);
//隐式启动,就失败
Intent intent =new Intent();
intent.setAction("cc.android.myAction");
startActivity(intent);
}
});
}
求教,谢谢!还有哪里没考虑周到么?
报错如下:
04-27 23:20:20.948: W/dalvikvm(14761): threadid=1: thread exiting with uncaught exception (group=0x40fc9300)
04-27 23:20:20.953: E/AndroidRuntime(14761): FATAL EXCEPTION: main
04-27 23:20:20.953: E/AndroidRuntime(14761): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=cc.android.myAction }
省略一部分 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询