Hi,

i"m trying to display image with name in listview.
My content is coming from database using SimpleCursorAdapter.

When i'm trying with this below code getting force close.

        setContentView(R.layout.places);
                DatabaseHelper dbHelper = new
DatabaseHelper(this.getApplicationContext());
                DbLoc = dbHelper.getWritableDatabase();
                String[] DBcolumns = new String[]{DatabaseHelper.LocationName,
DatabaseHelper.FriendMobile};
                Cursor cursor = DbLoc.rawQuery("SELECT "+
DatabaseHelper.LocationName +" ,"+ DatabaseHelper.LocationImage + "
FROM " + DatabaseHelper.LOCATIONTABLE , null);
                // the desired columns to be bound
                String[] columns = new String[] { DatabaseHelper.LocationName,
DatabaseHelper.LocationImage };
                // the XML defined views which the data will be bound to
                int[] to = new int[] { R.id.toptext, R.id.icon };
                cursorAdapter = new SimpleCursorAdapter(this, 
R.layout.placeslist,
cursor, columns, to);
                listContent.setAdapter(cursorAdapter);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to