Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6568987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:34:14+00:00 2026-05-25T14:34:14+00:00

my code is a ListActvity to Load data from dabase to listview public class

  • 0

my code is a ListActvity to Load data from dabase to listview

public class ViewList extends ListActivity {
private ListViewAdapter lAdapter;   

@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    lAdapter = new ListViewAdapter();
    DBAdapter db = new DBAdapter(this);
    db.open();      
    Cursor cursor = db.fetchAllDeliveryItem();
    lAdapter.setCursor(cursor);
    cursor.moveToFirst();
    //Toast.makeText(getApplicationContext(), cursor.getString(1), Toast.LENGTH_SHORT).show();
    setListAdapter(lAdapter);

}
private class ListViewAdapter extends BaseAdapter{
    //String data [] = {"_id","itemname","pickupaddress","deliveryaddress","delivered"};
    private LayoutInflater mInflater;
    //private ArrayList mData = new ArrayList();
    private Cursor cursor;  
     public ListViewAdapter() {
            mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        }

    public void setCursor(Cursor cursor)
    {
        this.cursor = cursor;
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public Object getItem(int position) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public long getItemId(int position) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        Log.i("GetView RUN","Runing runing");
        if (convertView == null) 
        {
            convertView = mInflater.inflate(R.layout.receiverow, null);
            holder = new ViewHolder();
            holder.textView = (TextView)convertView.findViewById(R.id.label);
            holder.checkbox = (CheckBox)convertView.findViewById(R.id.check);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder)convertView.getTag();
        }           
       // String getPosition[] = (String) mData.get(position);
        //holder.textView.setText(mData.get(position));    
       //holder.textView.setText(cursor.getString(1));
        holder.textView.setText("Test");
       if(cursor.getInt(4)!=0)
       holder.checkbox.setChecked(true);
       else
           holder.checkbox.setChecked(false);
        return convertView;
    }

}
public static class ViewHolder {
    public TextView textView;
    public CheckBox checkbox;
}

}

I see in Log cat the method public View getView(int position, View convertView, ViewGroup parent) doen’t invoked and listviewitems doesn’t appear on listview
how to fix it?
Thank you for support.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:34:15+00:00Added an answer on May 25, 2026 at 2:34 pm

    Don’t roll your own adapter when you can use SimpleCursorAdapter:

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    
        DBAdapter db = new DBAdapter(this);
        db.open();
        Cursor cursor = db.fetchAllDeliveryItem();
    
        // *** replace these strings with the actual *column names* of your query!
        String[] from = { "name_label_column", "name_check_column" };
        int[] to = { R.id.label, R.id.check };
    
        setListAdapter(new SimpleCursorAdapter(this, R.layout.receiverow, cursor, from, to));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below give generate the ListView public class MyList extends ListActivity { static
I have the following code snippet. public class ImageStoreActivity extends ListActivity { private DBHelper
Here is my code: public class TasksList extends ListActivity { ... private static final
I have the following code: public class Events extends ListActivity { //... private static
My code is : ListContacts.java public class ListContacts extends ListActivity { @Override public void
Here is my code for a simple cursor adapter. public class CursorList extends ListActivity
My code : ListContacts .java public class ListContacts extends ListActivity { @Override public void
I have following code: public class ShowActivity extends ListActivity implements OnItemClickListener { /** Called
By using the following code. BuyActivity.java public class BuyActivity extends ListActivity { public void
I have a piece of code public class Radio_groupActivity extends ListActivity { TextView selection;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.