0
我试图做的是当ImageButton
“ibItem1”被按下时打开“Items”。但是,设置后:ImageButton没有响应
ibItem1.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
Intent items = new Intent("android.intent.action.ITEMS");
startActivity(items);
}
});
然后单击按钮不会执行任何操作。我都在清单中设置了活动:
<activity
android:name="com.example.custombuilds.Items"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.ITEMS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
程序已经崩溃一ActivityNotFoundException
之前,因为,即使我宣布它在清单中。
从'FragmentActivity'扩展'com.example.custombuilds.Items'吗? – gunar
此外,对于一个意图的行动,我会强烈反对这个命名,你有:'android.intent.action.ITEMS' ...'android.intent.action。*'保留给Android操作。想象一下Android会在未来的版本中添加这个动作,并且会破坏你的应用,因为你不会处理这个动作。 – gunar