I want to know to get browse history on android ?

by eaindra nilar » Thu, 03 Sep 2009 09:15:17 GMT


Sponsored Links
 Thank
Sorry,
 I mean, I want to pull out web histroy from content provider  for my
application.



I have some coding. But I got exception .

So, how can I do ?please help me.
Here are my coding
package com.app.browser;


import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;



public class BrowserApp extends ListActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_activity_view);
        //Cursor
browserinfo=android.provider.Browser.getAllVisitedUrls(getContentResolver());

        String []proj= new String
[]{android.provider.Browser.SearchColumns._ID,
                android.provider.Browser.SearchColumns.DATE,
                android.provider.Browser.SearchColumns.SEARCH};
        Cursor results=

managedQuery(android.provider.Browser.SEARCHES_URI,proj,null,null,
android.provider.Browser.SearchColumns.URL+" ASC");
       /* if (results.moveToFirst())
        {
            do {
                DisplayTitle(results);
            } while (results.moveToNext());
        }


    }
    public void DisplayTitle(Cursor c)
    {

Toast.makeText(this,"url:"+c.getString(0)+"\t"+"search:"+c.getString(1)+"\t"+c.getString(2),Toast.LENGTH_LONG).show();

    }*/

        ListAdapter adapter = new SimpleCursorAdapter(
                this, // Context.
                android.R.layout.two_line_list_item,  // Specify the row
template to use (here, two columns bound to the two retrieved cursor rows).
                results,                                    // Pass in the
cursor to bind to.
                proj, // Array of cursor columns to bind to.
                new int[0]);                                 // Parallel
array of which template objects to bind to those columns.

        // Bind to our new adapter.
        setListAdapter(adapter);

        }
    }

--~--~---------~--~----~------------~-------~--~----~