ListView lv;
String values[] = new String[]{"Hello How r u","I am Fine"};
lv=(ListView)findViewById(R.id.listView1);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, festival);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0,View arg1,int position,long arg3) {
if(position==0) {
Intent i=new Intent(MainActivity.this ,SharingActivity.class );
i.putExtra("extra", values[0]);
startActivity(i);
}
}
}
lv.setAdapter(adapter);
嗨,这是我的 MainActivity。我想使用 Intent 向 SharingActivity 发送“Hello How are you”。如何?在SharingActivity 中,我有一个TextView。我想在 TextView 上打印此消息