我有这个代码:
import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class Bookmarks extends ListActivity{
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.bookmarks);
Database info=new Database(this);
info.open();
String data=info.getData();
String[] data_array = data.split(",");
info.close();
ListView listView1 = (ListView) findViewById(R.id.list_mia);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, data_array);
listView1.setAdapter(adapter);
listView1.setOnItemClickListener(){
public void onItemClick(AdapterView<?> a, View v, int position, long id){
if(data_array[position].startsWith("http://")){
//do this
}else{
//do this
}
}
}
}
}
这是正常工作。如果它有一个网址,我怎样才能使该项目可点击?我在网上尝试了各种帮助,但我无法让它工作!谢谢