问题
I am not able to create an intent after click in my Listview. After completing It gives an error
The application has stopped unexpectedly, please try again
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent IntentDiscution = new Intent(view.getContext(), lstchoi.class);
IntentDiscution.setClass(InterfaceAcceuil.this, lstchoi.class);
startActivityForResult(IntentDiscution, 0);
}
回答1:
Make sure you declared lstchoi in your manifest.xml. Assuming it is an Activity, you would do something like:
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".lstchoi"/>
You can also remove this line:
IntentDiscution.setClass(InterfaceAcceuil.this, lstchoi.class);
It is redundant because you used the constructor to indicate the same information.
来源:https://stackoverflow.com/questions/7005309/android-listview-intent