訪問數據庫值我的網頁這樣的數據庫:上一個ListView
import android.provider.BaseColumns;
public interface ThreadDatabase extends BaseColumns {
String TABLE_NAME = "Threads";
String TITLE = "Title";
String DESCRIPTION = "Description";
String URL = "Url";
String[] COLUMNS = new String[] { _ID, TITLE, DESCRIPTION, URL };
}
而且在我的活動與顯示標題和描寫的特徵每一行的SimpleCursorAdapter列表視圖。
Cursor c = dbhelper.getDatabase();
setListAdapter(new SimpleCursorAdapter(this,
android.R.layout.simple_list_item_2, c, new String[] {
ThreadDatabase.TITLE, ThreadDatabase.DESCRIPTION },
new int[] { android.R.id.text1, android.R.id.text2, })
我該如何重新定義onListItemClick方法,以便當我點擊該項目時正確的URL被打開?
protected void onListItemClick(ListView l, View v, int position, long id) {
???Missing part???
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
}