Issue tracker and errors in pages

by Andrea D'Amore » Fri, 20 May 2011 03:44:21 GMT

Sponsored Links
the Android project's issue tracker on Google Code [1] says it's only
for user bugs, is this group the right place to request corrections
for errors on AOSP's website pages?





Other Threads

1. Scrollable Menu Bar like Fox news app

If anybody know the code for create scrollable menubar in app..
Insted of tab i want that scrollable menu


2. problem with Search suggestions

I am trying to implement search suggestions in my app in the lines of
Searchable Dictionary, except that my data comes from a Sqlite

Everything seems to be working except the suggestions. I created a
sample animal database with these values
 {"Lion", "Tiger", "Elephant", "Deer", "Kangaroo"}

Now when I start typing and click on submit button it works fine.

example typing 't' and hitting search returns the list with Tiger and
Elephant. But when showing search suggestions it seems to get the
correct number of items being returned as it shows those many rows but
it does not populate them. When I click on any of the rows I see that
its not passing selectionArgs. It is being null.

What might be causing this issue?
Here is my Database class
package com.achie.gs1;

public class SampleDatabase {

        private static final String DATABASE_NAME = "zoodatabase.db";
        private static final String ANIMALS_TABLE = "animals";
        private static final int DATABASE_VERSION = 2;

        private final ZooOpenHelper mDatabaseOpenHelper;
        private static final HashMap<String, String> mColumnMap =

        public static final String ANIMAL_NAME = "name";

        public SampleDatabase(Context context) {
                mDatabaseOpenHelper = new ZooOpenHelper(context);

        private static HashMap<String, String> buildColumnMap() {
                HashMap<String, String> map = new HashMap<String, String>();
                map.put(ANIMAL_NAME, ANIMAL_NAME);
                map.put(BaseColumns._ID, "rowid AS "+BaseColumns._ID);
                map.put(SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID, "rowid AS
                map.put(SearchManager.SUGGEST_COLUMN_SHORTCUT_ID, "rowid AS

                return map;

        public Cursor getAnimal(String rowId, String[] columns) {
                String selection = "rowid = ?";
                String[] selectionArgs = new String[] {rowId};
                return query(selection, selectionArgs, columns);

        public Cursor getAnimalMatches(String query, String[] columns) {
                String selection = ANIMAL_NAME + " LIKE ?";
                String[] selectionArgs = new String[] {"%"+query+"%"};
                return query(selection, selectionArgs, columns);

        private Cursor query(String selection, String[] selectionArgs,
String[] columns) {
                SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

                Cursor cursor = 
columns, selection, selectionArgs, null, null, null);
                if(cursor == null) {
                        return null;
                } else if (!cursor.moveToFirst()) {
                        return null;
                return cursor;

        private static class ZooOpenHelper extends SQLiteOpenHelper {

                private SQLiteDatabase mDatabase;
                private static final String CREATE_ANIMALS_TABLE = "CREATE TABLE
                        " (_id integer primary key autoincrement, 
"+ANIMAL_NAME+" text not
                private static final String[] ANIMALS = new String[] {"Lion",
"Tiger", "Elephant", "Deer", "Kangaroo"};

                public ZooOpenHelper(Context context) {
                        super(context, DATABASE_NAME, null, DATABASE_VERSION);

                public void onCreate(SQLiteDatabase db) {
                        mDatabase = db;

                public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {}

                private void loadDatabase() {
                        new Thread(new Runnable() {
                                public void run() {

                private void loadAnimals() {
                        for (int i=0; i<ANIMALS.length; i++) {
                                ContentValues initialValues = new 
                                initialValues.put("name", ANIMALS[i]);
                                mDatabase.insert(ANIMALS_TABLE, null, 

Here is my content provider
package com.achie.gs1;

public class SampleProvider extends ContentProvider{

        public static String AUTHORITY = "com.achie.gs1.SampleProvider";
        public static final Uri CONTENT_URI = Uri.parse("content://"+AUTHORITY

        public static final String ANIMALS_MIME_TYPE =
        public static final String ANIMAL_ITEM_MIME_TYPE =

        private SampleDatabase mDatabase;

        private static final int GET_ANIMALS = 0;
        private static final int GET_ANIMAL_ITEM = 1;
        private static final int ANIMAL_SUGGEST = 2;
        private static final int SHORTCUT_REFRESH = 3;

        private static final UriMatcher sUriMatcher = buildUriMatcher();

        private static UriMatcher buildUriMatcher() {
                UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
                // Get animals
                matcher.addURI(AUTHORITY, "animals", GET_ANIMALS);
                matcher.addURI(AUTHORITY, "animals/#", GET_ANIMAL_ITEM);
                // To get suggestions
                matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY,
                matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY 
+ "/


                return matcher;

        public boolean onCreate() {
                mDatabase = new SampleDatabase(getContext());
                return true;

        public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
                switch(sUriMatcher.match(uri)) {
                        case ANIMAL_SUGGEST:
                                if (selectionArgs == null){
                                        throw new IllegalArgumentException(" 
selectionArgs must be
provided for the uri for suggestion at a:\n "+uri);
                                return searchAnimals(selectionArgs[0]);
                        case GET_ANIMALS:
                                if (selectionArgs == null){
                                        throw new IllegalArgumentException(" 
selectionArgs must be
provided for the uri for searching animals at a:\n "+uri);
                                return searchAnimals(selectionArgs[0]);
                        case GET_ANIMAL_ITEM:
                                return getAnimal(uri);
                        case SHORTCUT_REFRESH:
                                return refreshShortcut(uri);
                                throw new IllegalArgumentException("Unknown Uri 
at a: "+uri);

        public String getType(Uri uri) {
                switch (sUriMatcher.match(uri)) {
                        case GET_ANIMALS:
                                return ANIMALS_MIME_TYPE;
                        case GET_ANIMAL_ITEM:
                                return ANIMAL_ITEM_MIME_TYPE;
                        case ANIMAL_SUGGEST:
                                return SearchManager.SUGGEST_MIME_TYPE;
                        case SHORTCUT_REFRESH:
                                return SearchManager.SHORTCUT_MIME_TYPE;
                                throw new IllegalArgumentException("unknown Url 

        private Cursor refreshShortcut(Uri uri) {
                String rowId = uri.getLastPathSegment();
                String[] columns = new String[] {
                return mDatabase.getAnimal(rowId, columns);

        private Cursor searchAnimals(String query) {
                query = query.toLowerCase();
                String[] columns = new String[] {BaseColumns._ID,
                return mDatabase.getAnimalMatches(query, columns);

        private Cursor getAnimal(Uri uri) {
                String rowId = uri.getLastPathSegment();
                String[] columns = new String[] {SampleDatabase.ANIMAL_NAME};
                return mDatabase.getAnimal(rowId, columns);

        public int delete(Uri uri, String selection, String[] selectionArgs)
{return 0;}
        public Uri insert(Uri uri, ContentValues values) {return null;}
        public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) { return 0;     }
Thank you,


3. Rotate bitmap in opengl

4. myLocationOverlay - customizing the compass position on screen?

5. Creating Sliding Drawer in new look

6. Align Custom Dialog at the bottom of the screen

7. Google analytics install referrer problem