How fix bookmark's list item click listener
<p>I read bookmarks from database, show it by a listview, but when click
list item it can't load url correctly, some codes  from browser app
source.</p>

<p>I have not much experience about android and java, this trouble have
confused me two days</p>

<p>Thanks for your help</p>

<pre><code>public class bookmarks extends Activity {
private Cursor bookmarks;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    bookmarks = Browser.getAllBookmarks(getContentResolver());
    int urlColumn = bookmarks.getColumnIndex(android.provider.Browser.BookmarkColumns.URL);
    Cursor results;
    String[] proj = new String[]{
        android.provider.Browser.BookmarkColumns.URL,
        android.provider.Browser.BookmarkColumns.TITLE
    };
    int[] to = new int[]{
        android.R.id.text2,
        android.R.id.text1
    };

    String whereClause;
    String orderBy = Browser.BookmarkColumns.VISITS + " DESC";
    whereClause = Browser.BookmarkColumns.BOOKMARK + " != 0";

    results = managedQuery(Browser.BOOKMARKS_URI,
            Browser.HISTORY_PROJECTION, whereClause, null, orderBy);
    startManagingCursor(results);

    ListAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_2, results, proj, to);
    ListView myListView = (ListView) findViewById(R.id.list);
    myListView.setAdapter(adapter);
    myListView.setOnItemClickListener(mListener);       // 设置点击

}

// 侦听事件
private AdapterView.OnItemClickListener mListener = new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView&lt;?&gt; adapterView, View v, int position, long id) {
        // TODO Auto-generated method stub
        loadUrl(position);
    }

};

// 载入网址
private void loadUrl(int position) {
    Intent intent = (new Intent()).setAction(getUrl(position));
    setResultToParent(RESULT_OK, intent);
    finish();
}

public String getUrl(int position) {
    String url = getString(Browser.HISTORY_PROJECTION_URL_INDEX, position);
    return url;
}

// This Activity is generally a sub-Activity of CombinedHistoryActivity. In
// that situation, we need to pass our result code up to our parent.
// However, if someone calls this Activity directly, then this has no
// parent, and it needs to set it on itself.
private void setResultToParent(int resultCode, Intent data) {
    Activity a = getParent() == null ? this : getParent();
    a.setResult(resultCode, data);
}
</code></pre>

<p>}</p>
