I am Facing a problem in setting a ListView in android . Everything works ok but it is not setting the way i want it to set . here are the images whats happening
You are using multiple adapters in your list view.
listview.setAdapter(new MyNotiAdapter(noticall.this, adi,adi1,adi2,adi3));
And later
listview.setAdapter(cursorAdapter);
While, yes, the code runs, you are seeing some unexpected results.
For example, that second image looks like you are displaying an Arraylist in one row instead of an element per row.
And that is probably caused by this line where you toString some arraylists
mySQLiteAdapter.insert(myrows.toString(),time1.toString(),name1.toString(),number1.toString());
So, my suggestion is use one adapter (probably just a CursorAdapter since you are using SQLite) to display your data. And you can setAdapter
only once inside onCreate
and never need to set it again. You only reload the cursor.
Another thing to note. Don't iterate on the cursor after you add it to an adapter. Because the adapter reads the cursor and displays its contents, then you are later exhausting the iterator.
Cursor cursor = mySQLiteAdapter.getAllData();
startManagingCursor(cursor);
// ...
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(noticall.this, R.layout.row2, cursor, from, to);
while (cursor.moveToNext()){ // <--- This is bad