如何在单击列表视图中的列表项时调用新的类视图?
我正在 Android 中开发一个应用程序,我必须在单击列表视图中的项目时调用一个类。我已经为其开发了类,但单击时不会调用类视图。我不明白为什么?
这是我要调用的类的代码
public void onItemClick(AdapterView parent, View v, int position, long id)
{
Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]");
Intent itemintent = new Intent(this,ShowDescription.class);
Bundle b = new Bundle();
b.putString("title", feed.getItem(position).getTitle());
b.putString("description", feed.getItem(position).getDescription());
b.putString("link", feed.getItem(position).getLink());
b.putString("pubdate", feed.getItem(position).getPubDate());
itemintent.putExtra("android.intent.extra.INTENT", b);
startSubActivity(itemintent,0);
}
private void startSubActivity(Intent itemintent, int i) {
// TODO Auto-generated method stub
}
,并提前感谢
i am developing an application in android for which i have to call a class on click of an item in list view.i have developed the classes for it but on click the class view is not called. I can't understand why?
here is my code for the class to be called
public void onItemClick(AdapterView parent, View v, int position, long id)
{
Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]");
Intent itemintent = new Intent(this,ShowDescription.class);
Bundle b = new Bundle();
b.putString("title", feed.getItem(position).getTitle());
b.putString("description", feed.getItem(position).getDescription());
b.putString("link", feed.getItem(position).getLink());
b.putString("pubdate", feed.getItem(position).getPubDate());
itemintent.putExtra("android.intent.extra.INTENT", b);
startSubActivity(itemintent,0);
}
private void startSubActivity(Intent itemintent, int i) {
// TODO Auto-generated method stub
}
and thanx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将您的代码更改为此
}
我希望这里的“feed”是您的ListView。当您想在下一个活动中获取值时,请使用以下命令:-
这会有所帮助..如果问题仍然存在,请回复..
Change your code to this
}
I hope the "feed" here is your ListView. When you want to get the values in your next activity use the following:-
This will help.. Do reply if the problem still persists..