开发者

View an activity on button click

I want to show the details of a list item in another act开发者_开发技巧ivity when clicks on a button.Can you help me?


Though it would be better if you would mention some details... as far as i can guess u want to use some data from a previous activity to show in another activity.. The method to do this is putExtras in intent.. e.g.

Intent intent = new Intent(this, nxtActivityName.class);
intent.putExtra(name, value);
startActivity(intent);

In the target activity, u can retrieve the data in the onCreate() method by using getIntent().getStringExtra(name); and use it as desired..

And if you are using a list, its better you use a ListActivity and override the onListItemClick(ListView l, View v, int position, long id) for doing ur needful...


Additional to this you have to add a onClickListener on your selected button

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜