Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try to use below code may it help you..</p> <pre><code>public class CustAdp extends ArrayAdapter&lt;String&gt; { Cursor cursor_subCat; public CustAdp(Context context, Cursor cursor_subcategory) { super(context, id); this.cursor_subCat = cursor_subcategory; cursor_subCat.moveToFirst(); } public int getCount() { // TODO Auto-generated method stub return cursor_subCat.getCount(); } public String getItem(int position) { // TODO Auto-generated method stub cursor_subCat.moveToPosition(position); return cursor_subCat.getString(cursor_subCat .getColumnIndex("Sub_CatName")); } public long getItemId(int position) { // TODO Auto-generated method stub cursor_subCat.moveToPosition(position); return cursor_subCat.getInt(cursor_subCat .getColumnIndex("Sub_IdAuto")); } @Override public void notifyDataSetChanged() { // TODO Auto-generated method stub super.notifyDataSetChanged(); cursor_subCat.requery(); } public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub convertView = getLayoutInflater().inflate(R.layout.customsubcat, null); ImageView iv_subcat = (ImageView) convertView .findViewById(R.id.image_region1); TextView tv_subcat = (TextView) convertView .findViewById(R.id.txt_regionname1); Button btn_subcat = (Button) convertView .findViewById(R.id.button_delete_subcat); cursor_subCat.moveToPosition(position); try { byte[] subimage = cursor_subCat.getBlob(cursor_subCat .getColumnIndex("Sub_CatImage")); Bitmap bm = BitmapFactory.decodeByteArray(subimage, 0, subimage.length); iv_subcat.setImageBitmap(bm); tv_subcat.setText(cursor_subCat.getString(cursor_subCat .getColumnIndex("Sub_CatName"))); subcat_id = cursor_subCat.getLong(cursor_subCat .getColumnIndex("Sub_IdAuto")); btn_subcat.setId((int) subcat_id); id = cursor_subCat.getInt(cursor_subCat .getColumnIndex("Sub_MyReceipe")); convertView.setId(position); } catch (Exception e) { // TODO: handle exception } return convertView; } class ViewHolder { TextView tv_subcat; Button btn_subcat; ImageView iv_subcat; } } </code></pre> <p>Just pass your cursor to custom adapter class.And change layout whatever you want.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload