I continued with my trial code. This one does not retrieve anything,
using the DevPhone on Cupcake.
Then, I read the source for the Browser's BrowserProvider which
suggests that you need to give something to query. (the commented code
below). However, that causes an Exception inside the BrowserProvider
(at the bottom)
Thanks!
package com.paraz.history;
import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Browser;
import android.util.Log;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;
public class BrowserHistoryActivity extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_activity_view);
final String[] proj = new String[] {
Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.URL,
Browser.BookmarkColumns.DATE };
Cursor results =
getContentResolver().query(Browser.BOOKMARKS_URI,
proj, null, null, null);
// Cursor results =
getContentResolver().query(Browser.BOOKMARKS_URI,
// proj, Browser.BookmarkColumns.TITLE, new
String[] {"google"},
null);
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, 1}); // Parallel array of which
template objects to
bind
// to those columns.
// Bind to our new adapter.
setListAdapter(adapter);
}
}
09-12 14:26:39.294 E/DatabaseUtils( 1022):
android.database.sqlite.SQLiteException: bind or column index out of
range: handle 0x196720
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteProgram.native_bind_string(Native
Method)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:
178)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteQuery.bindString(SQLiteQuery.java:190)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteDirectCursorDriver.query
(SQLiteDirectCursorDriver.java:55)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteDatabase.rawQueryWithFactory
(SQLiteDatabase.java:1118)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteDatabase.queryWithFactory
(SQLiteDatabase.java:1006)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:964)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1078)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
com.android.browser.BrowserProvider.query(BrowserProvider.java:574)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.content.ContentProvider$Transport.bulkQuery
(ContentProvider.java:112)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.content.ContentProviderNative.onTransact
(ContentProviderNative.java:97)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
android.os.Binder.execTransact(Binder.java:287)
09-12 14:26:39.294 E/DatabaseUtils( 1022): at
dalvik.system.NativeStart.run(Native Method)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---