Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplay data into listview
    primarykey
    data
    text
    <p>the following code display information from sqlite database on a listview. 1st it shows Date and the listview allows me to click, when i click on a date it shows me information that was done on that date on a listview. my problem is when i save data on this date 12.01.2013 and i repeat the same date later on then it displays the same date twice and i want it just to display one date and when i click on it to show me the data that i saved in the morning and the data that i saved later on the same day not two similar dates.</p> <p>hereis the code</p> <pre><code>public class Pro extends Activity implements OnItemClickListener { private ListView uNamesListView; private ListAdapter customerListAdapter; private ArrayList&lt;PojoClass&gt; pojoArrayList; final Context context = this; private Button button; private TextView result; DBAdapter db = new DBAdapter(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); uNamesListView = (ListView) findViewById(R.id.listView1); uNamesListView.setOnItemClickListener(this); pojoArrayList = new ArrayList&lt;PojoClass&gt;(); customerListAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, populateList()); uNamesListView.setAdapter(customerListAdapter); } public List&lt;String&gt; populateList() { List&lt;String&gt; uGraduateNamesList = new ArrayList&lt;String&gt;(); DatabaseHelper openHelperClass = new DatabaseHelper(this); SQLiteDatabase sqliteDatabase = openHelperClass.getReadableDatabase(); Cursor cursor = sqliteDatabase.query(DBAdapter.SCAN_TABLE, null, null, null, null, null, null); startManagingCursor(cursor); while (cursor.moveToNext()) { String cDate = cursor.getString(cursor.getColumnIndex(DBAdapter.COLUMN_Date )); String cMeterNumber = cursor.getString(cursor.getColumnIndex(DBAdapter.COLUMN_MeterNumber )); String cVname = cursor.getString(cursor.getColumnIndex(DBAdapter.COLUMN_Vname )); String cPname = cursor.getString(cursor.getColumnIndex(DBAdapter.COLUMN_PName )); PojoClass ss = new PojoClass(); ss.SetName(cDate); ss.SetSurname(cMeterNumber); ss.SetID(cVname); ss.SetHaddress(cPname); pojoArrayList.add(ss); uGraduateNamesList.add(cDate); } sqliteDatabase.close(); return uGraduateNamesList; } @Override public void onItemClick(AdapterView&lt;?&gt; aa, View view, int ss, long bb) { // TODO Auto-generated method stub Intent updateCustomerIntent = new Intent(Pro.this, ViewByVendor.class); updateCustomerIntent.putExtra("product", product); startActivity(updateCustomerIntent); Toast.makeText(getApplicationContext(), "Clicked on :" + ss, Toast.LENGTH_SHORT).show(); PojoClass clickedObject = pojoArrayList.get(ss); Bundle dataBundle = new Bundle(); dataBundle.putString("clickedDate", clickedObject.getDates()); dataBundle.putString("clickedMeterNumber", clickedObject.getMeterNumber()); dataBundle.putString("clickedVname", clickedObject.getVname()); dataBundle.putString("clickedPname", clickedObject.getPname()); updateCustomerIntent.putExtras(dataBundle); startActivity(updateCustomerIntent); } } </code></pre> <p>i will appreciate your help.</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.
 

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