Android的列表视图意图 [英] android listview intent

查看:98
本文介绍了Android的列表视图意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能够点击我的列表视图后创建的意图。完成后,它给出了一个错误

  

应用程序已意外停止,请重试

 公共无效onItemClick(适配器视图<>母公司视图中查看,INT位置,长的id){
     意图IntentDiscution =新的意图(view.getContext(),lstchoi.class);
     IntentDiscution.setClass(InterfaceAcceuil.this,lstchoi.class);
     startActivityForResult(IntentDiscution,0);
}
 

解决方案

请确保你在你的manifest.xml声明 lstchoi 。假设它是一个活动,你会做这样的事情:

 <应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>

        <活动机器人:lstchoiNAME = />
 

您也可以删除此行:

  IntentDiscution.setClass(InterfaceAcceuil.this,lstchoi.class);
 

这是多余的,因为你使用的构造函数来表示相同的信息。

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);
}

解决方案

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.

这篇关于Android的列表视图意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆