更新时间:2022-09-30 08:04:18
代码:
1
2
3
4
5
6
7
8
9
10
|
findViewById(R.id.button1).setOnClickListener( new OnClickListener()
{ @Override
public void onClick(View v)
{
Intent intent = new Intent();
intent.setAction( "org.yuchen.AAA" ); //设置intent
startActivity(intent );
}
}); |
配置xml文件:
1
2
3
4
5
6
7
8
|
<activity android:name= "com.example.ex04_layout.SecondActivity"
android:label= "@string/title_activity_second" >
<intent-filter >
<action android:name= "org.yuchen.AAA" />
<category android:name= "android.intent.category.DEFAULT" /><!-- 隐式意图:category这一句必须添加 -->
</intent-filter>
</activity> |