title: SQLite table not displaying data on activity
body: <p>I have successfully created a database table with SQlite.However when i try to use a custom adapter to display the data in rows,the activity is blank,as in it does not display the data i saved into it.</p>
  
  <p>This is how i get data from my data base in <strong>DBHelper class that extends SQLiteOpenHelper</strong> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public ArrayList&lt;ContactListItems&gt; getAllContacts() {
          ArrayList&lt;ContactListItems&gt; contactList = new ArrayList&lt;&gt;();
          hp = new HashMap();
          SQLiteDatabase db = this.getReadableDatabase();
          Cursor res = db.rawQuery("select * from contacts", null);
              if (res.moveToFirst()) {
                  do {
              ContactListItems contactListItems = new ContactListItems();
  
              contactListItems.setTitle(res.getString(res
                      .getColumnIndex("title")));
              contactListItems.setAmount(res.getString(res
                      .getColumnIndex("amount")));
              contactListItems.setDescription(res.getString(res
                      .getColumnIndex("description")));
              res.moveToNext();
                  } while (res.moveToNext());
              }
  
          return contactList;
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And in <strong>MyBasket</strong> Activity,this is how i display the data with <strong>ContactListAdapter</strong>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> private void showTable() {
          ArrayList&lt;ContactListItems&gt; contactList = myDb.getAllContacts();
  
          ContactListAdapter contactListAdapter = new ContactListAdapter(
                  MyBasket.this, contactList);
          //adding it to the list view.
  obj = (ListView) findViewById(R.id.listView1);
          obj.setAdapter(contactListAdapter);
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>ContactListItems:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public class ContactListItems {
      String title;
      String amount;
      String description;
  
      public String getTitle() {
          return title;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getAmount() {
          return amount;
      }
  
      public void setAmount(String amount) {
          this.amount = amount;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>ContactListAdapter:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public class ContactListAdapter extends BaseAdapter {
  
      Context context;
      ArrayList&lt;ContactListItems&gt; contactList;
  
      public ContactListAdapter(Context context, ArrayList&lt;ContactListItems&gt; list) {
  
          this.context = context;
          contactList = list;
      }
  
      @Override
      public int getCount() {
  
          return contactList.size();
      }
  
      @Override
      public Object getItem(int position) {
  
          return contactList.get(position);
      }
  
      @Override
      public long getItemId(int position) {
  
          return position;
      }
  
  
      @Override
      public View getView(int position, View convertView, ViewGroup arg2) {
          ContactListItems contactListItems = contactList.get(position);
  
          if (convertView == null) {
              LayoutInflater inflater = (LayoutInflater) context
                      .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              convertView = inflater.inflate(R.layout.contact_list_row, null);
  
          }
          TextView tvSlNo = (TextView) convertView.findViewById(R.id.tv_slno);
          tvSlNo.setText(contactListItems.getTitle());
          TextView tvName = (TextView) convertView.findViewById(R.id.tv_name);
          tvName.setText(contactListItems.getAmount());
          TextView tvPhone = (TextView) convertView.findViewById(R.id.tv_phone);
          tvPhone.setText(contactListItems.getDescription());
  
          return convertView;
      }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The code runs fine with no errors but no display of data.I really do not see where i have gone wrong.Any assistance will be appreciated and if you need more code let me know.</p>
  
  <p><strong>Edit</strong>
  So as to understand better
  When i was using this code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>private void showTable() {
          ArrayList&lt;String&gt; array_list = myDb.getAllContacts();
  
          ArrayAdapter arrayAdapter;
          arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, array_list);
  
          //adding it to the list view.
          obj = (ListView) findViewById(R.id.listView1);
          obj.setAdapter(arrayAdapter);
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public ArrayList&lt;String&gt; getAllContacts() {
          ArrayList&lt;String&gt; array_list = new ArrayList&lt;&gt;();
          hp = new HashMap();
          SQLiteDatabase db = this.getReadableDatabase();
          Cursor res = db.rawQuery("select * from contacts", null);
          res.moveToFirst();
          while (res.isAfterLast() == false) {
              array_list.add("Product: " + res.getString(res.getColumnIndex(CONTACTS_COLUMN_TITLE)));
              array_list.add("Amount: " + res.getString(res.getColumnIndex(CONTACTS_COLUMN_AMOUNT)));
              array_list.add("Description: " + res.getString(res.getColumnIndex(CONTACTS_COLUMN_DESC)));
              System.out.print("database data:" + res.getString(res.getColumnIndex(CONTACTS_COLUMN_TITLE)));
              System.out.print("database data:" + res.getString(res.getColumnIndex(CONTACTS_COLUMN_AMOUNT)));
              System.out.print("database data:" + res.getString(res.getColumnIndex(CONTACTS_COLUMN_DESC)));
              System.out.print("List holds:" + array_list);
              res.moveToNext();
          }
          return array_list;
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The data was being displayed properly but i wanted to customize the rows insted of using the arraylist.</p>