我在试图弄清楚如何为列表视图中的所有项目添加操作时遇到了一些问题。我的意思是当一个项目被按下时我想做一些事情。现在,我按下一个项目,没有任何动作。我想让它做点什么,这就是我需要帮助的地方。
这是我在 MainActivity 中使用的代码:
public class MainActivity extends Activity {
private ListView listView1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViedoStream viedoStream_data[] = new ViedoStream[]
{
new ViedoStream(R.drawable.image0, "Mission TV"),
new ViedoStream(R.drawable.image1, "HCBN Philippines"),
new ViedoStream(R.drawable.image2, "Global Family Network"),
new ViedoStream(R.drawable.image3, "2CBN"),
new ViedoStream(R.drawable.image4, "Red ADvenir"),
new ViedoStream(R.drawable.image5, "Alfa Television"),
new ViedoStream(R.drawable.image6, "Light Channel Hungary"),
new ViedoStream(R.drawable.image7, "Light Channel Rumania"),
new ViedoStream(R.drawable.image8, "Light Channel Germany"),
new ViedoStream(R.drawable.image9, "Terceiro Anjo"),
new ViedoStream(R.drawable.image10, "HCBN Indonesia"),
new ViedoStream(R.drawable.image11, "TV Famille")
};
ViedoStreamAdapter adapter = new ViedoStreamAdapter(this,
R.layout.listview_item_row, viedoStream_data);
listView1 = (ListView)findViewById(R.id.listView1);
View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null);
listView1.addHeaderView(header);
listView1.setAdapter(adapter);
}
}
按下什么项目,我想从 http 流播放视频流,但我知道如何执行这种类型的操作。我只需要知道如何让它做某事。
有人可以帮我做这件事吗?顺便说一句,我是 Android 平台的新手。
谢谢