开发者

How can I start an activity when the user clicks on a ListItem?

Here is my code. I'd like to pass a boo开发者_开发技巧lean to the activity i want to start.

private void setupUI() {
        setContentView(R.layout.more_tab_activity);
        listView = (ListView) findViewById(R.id.streamListView);
        listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , streams));
        listView.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> a, View v, int position, long id) {
                //start the streamactivity
            }
        });
    }


Have you looked at any tutorials?

Intent i = new Intent(MyActivity.this, StreamActivity.class);
i.putExtra("id", true);
startActivity(i);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜