android listview intent

泪湿孤枕 提交于 2019-12-04 06:52:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!