I have an activity with multiple list views that are continuously receiving new values form a socket thread, another thread parses the data and updates the array adapters, then the ui thread calls notifyDataSetChanged() to cause the list to refresh.
My issue is that im refreshing all the list a couple of time a second, this causes the UI to be very laggy when some animations need to happen.
I was wondering what the best way is to update multiple lists with multiple value changes every second?
Thanks,
Totem.
I would definately follow the guidelines they gave at Google IO this year.
Google IO listview Video
You should use Cursors (if required Content Providers) and ListActivity. The UI automatically updates as soon as there are changes and in case of null data sets, the list automatically displays a relevant view.
Following examples solves it using content providers:
main.xml:
<ListView android:id="#id/android:list" android:layout_width="fill_parent"
android:layout_height="wrap_content"></ListView>
<TextView android:id="#id/android:empty" android:layout_width="fill_parent"
android:gravity="center" android:layout_height="wrap_content"
android:text="No data, please refresh!" />
Notice the android:list and android:empty tags. These are required by the list activity.
In onCreate() method:
mCursor = getContentResolver().query(SOME_URI,
null, null, null, null);
ListView mListView = (ListView) findViewById(android.R.id.list);
mListView.setAdapter(new CustomCusorAdapter(getApplicationContext(),
mCursor));
You can use a SimpleCursorAdapter if your views are straight-forward. I created by own adapter because of the complex views:
private class CustomCusorAdapter extends CursorAdapter {
public CustomCusorAdapter(Context context, Cursor c) {
super(context, c);
}
#Override
public void bindView(View view, Context context, Cursor cursor) {
Holder holder = (Holder) view.getTag();
holder.tv.setText(cursor.getString(cursor
.getColumnIndex(COL1_NAME)));
}
#Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View v = getLayoutInflater().inflate(
R.layout.layout_xml, null);
Holder holder = new Holder();
holder.tv = (TextView) v
.findViewById(R.id.tv);
holder.cb= (CheckBox) v
.findViewById(R.id.cb);
v.setTag(holder);
return v;
}
}
private class Holder {
TextView tv;
CheckBox cb;
}
Yes, that video is very helpful. One of the biggest take aways is that you should recycle the convertView passed into your list adapters getView method:
public View getView(int position, View convertView, ViewGroup parent){
if (convertView == null) {
convertView = mInflator.inflate(resource, parent, false);
}
//do any view bindings for the row
return convertView;
}
The other helpful bit was to use a ViewHolder class for the view recycling. It's at ~10:30 into the vid.
Related
I am using this library to create swipe-able cards : https://github.com/Diolor/Swipecards
The view which makes the swipe-able cards control, gets attached to an adapter and sources it's drawing from it.
In my implementation, every card has a button, and when it is clicked, something in the source array changes, for which I want to refresh the whole card list. I call notifyDataSetChanged() on the associated adapter, but the getView() never gets called in the adapter to see any updates.
What's strange is that the same adapter works perfectly with a ListView
Is there any specific requirement either in the adapter's side or in the view itself which is required for the proper functioning of notifyDataSetChanged?
My Code:
(Please ignore the absence of ViewHolder pattern and the presence of click receivers inside the adapter. Code quality is the least thing I can be concerned about right now when a crucial functionality isn't working)
Adapter (using Array Adapter)
public class TourCardAdapter extends ArrayAdapter<TourCardBean> implements View.OnClickListener {
Context context;
ToursFragment.ToursControlsClickListener clickListener;
public TourCardAdapter(Context context, ArrayList<TourCardBean> tourCardsArr, ToursFragment.ToursControlsClickListener clickListener) {
super(context, 0, tourCardsArr);
this.context = context;
this.clickListener = clickListener;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
ViewHolder viewHolder;
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
TourCardBean tourCard = getItem(position);
rowView = inflater.inflate(R.layout.card_tour, parent, false);
viewHolder = new ViewHolder();
viewHolder.title = (TextView) rowView
.findViewById(R.id.title);
viewHolder.detail = (TextView) rowView
.findViewById(R.id.detail);
viewHolder.likeCount = (TextView) rowView
.findViewById(R.id.likeCount);
viewHolder.image = (ImageView) rowView
.findViewById(R.id.cardLocationImage);
viewHolder.likeButton = (ImageView) rowView
.findViewById(R.id.cardLikeImage);
viewHolder.shareButton = (ImageView) rowView
.findViewById(R.id.cardShareImage);
viewHolder.likeButton.setOnClickListener(this);
viewHolder.shareButton.setOnClickListener(this);
viewHolder.title.setText(tourCard.getTitle());
viewHolder.detail.setText(tourCard.getDetails());
viewHolder.likeCount.setText("" + tourCard.getLikeCount());
viewHolder.likeButton.setTag(tourCard.getId());
viewHolder.shareButton.setTag(tourCard.getId());
return rowView;
}
#Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.cardLikeImage:
clickListener.onLikeClick((int) v.getTag());
break;
case R.id.cardShareImage:
clickListener.onShareClick((int) v.getTag());
break;
}
}
/**
* View Holder for ListView
*
* #author Aman Alam
*/
class ViewHolder {
public ImageView image;
public ImageView likeButton;
public ImageView shareButton;
public TextView title;
public TextView detail;
public TextView likeCount;
}
}
If it works with the ListView, your Adapter shouldn't be the problem.
The SwipeFlingAdapterView is (more or less) directly based on AdapterView which doesn't call getView() at all. So it's its responsibility to make a call to getView() when the dataset was changed. The relevant portion of the code seems to be, which might be blocked by your click event:
if (this.flingCardListener.isTouching()) {
PointF lastPoint = this.flingCardListener.getLastPoint();
if (this.mLastTouchPoint == null || !this.mLastTouchPoint.equals(lastPoint)) {
this.mLastTouchPoint = lastPoint;
removeViewsInLayout(0, LAST_OBJECT_IN_STACK);
layoutChildren(1, adapterCount);
}
}
Overall the SwipeFlingAdapterView doesn't seem to be prepared for a dataset change event at all.
Based on some of the issues logged against the Swipecards library, it appears that it may have bugs that prevent it from updating the views on notifyDataSetChanged(). This one has a couple of workarounds that might work for you. Specifically, flingContainer.removeAllViewsInLayout().
Libraries can be very useful, but I think it is wise you use the support library offered by google.
You get the benefits of getting the latest updates in material design as soon they are released.
You can declare in your gradle file. this;
compile 'com.android.support:design:22.2.0'
I recently encountered an issue where the animation of an indeterminate ProgressBar used inside of a ListView row became choppy. In a nutshell, I have a ListView where each row contains a ProgressBar. The animations look great, until I scroll; from then on, at least one of the ProgressBar will have a choppy animation.
Does anyone know how to fix this problem?
View for the ListView row
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:indeterminate="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Simple custom ArrayAdapter
public class MyAdapter extends ArrayAdapter {
List list;
public MyAdapter(Context context, List objects) {
super(context, 0, objects);
list = objects;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
convertView = ((LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.list_row, parent, false);
}
return convertView;
}
}
OnCreate() method for the sample Activity
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
ListView listView = (ListView)findViewById(R.id.list_view);
ArrayList<Integer> data = new ArrayList<Integer>(Arrays.asList(1,2,3,4,5,6,7,8,9,0,11,12,13,14,15,16,17));
MyAdapter adapter = new MyAdapter(this, data);
listView.setAdapter(adapter);
}
Bug logged (contains sample project): https://code.google.com/p/android/issues/detail?id=145569&thanks=145569&ts=1423673226
Try implementing the view holder pattern and check the performance.
Create a static ViewHolder class with a progress bar.
static class ViewHolder {
ProgressBar progress;
}
and in your getView() you get find the view holder from the view only when the convertView is null, otherwise take it from the tag holding the viewHolder. This way you are inflating a new view only when the convertView is null, otherwise you are using the views stored in your viewholder tag.
A simple tutorial can be found here.
it is happening for the first time only, if you close and reopen the app, you will not notice it.
Did you check in older versions like kitkat?
And dont create LayoutInflater in the getView(), create once in the constructor and use it in the constuctor
I trying to make a listview which contains a view in every row. This view contains 2 textviews and 1 gridview which is 2 columns. In every column I use a basic layout which is consist of 2 textviews.
This is preview of basic layout which is used in every block of gridview.
Here is its xml; -First view-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/listview_item">
<TextView
android:layout_width="220dp"
android:layout_height="wrap_content"
android:textSize="18dp"
android:text="Item Name"
android:id="#+id/list_item"
android:maxLines="1"
android:layout_marginLeft="5dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Price"
android:textSize="18dp"
android:id="#+id/item_price"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5dp"/>
</RelativeLayout>
Here is my second view which contains 2 textview and 1 gridview.
Here its xml; -Second view-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/listview_item"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp"
android:text="Kategori"
android:id="#+id/categories_title_list_layout"/>
<GridView
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="#+id/gridView_list_layout"
android:numColumns="2"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not: Lorem ipsum dolor sit amet.."
android:textSize="18dp"
android:id="#+id/categories_note"/>
</LinearLayout>
Here is my last view; -Third view-
This listview's every row takes shape of my second view which takes shape of first view.
Here is my adapter which are create this views.
For first view I use this adapter;
public class ItemListAdapter extends BaseAdapter {
private Context context;
private ArrayList<Item> items;
public ItemListAdapter(Context context, ArrayList<Item> items) {
super();
this.context = context;
this.items = items;
}
public int getCount() {
return items.size();
}
public Object getItem(int i) {
return items.get(i);
}
public long getItemId(int i) {
return i;
}
public View getView(final int i, View view, ViewGroup viewGroup) {
ViewHolder holder;
if(view == null) {
holder = new ViewHolder();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.listview_item_content, null);
holder.title = (TextView) view.findViewById(R.id.list_item);
holder.price = (TextView) view.findViewById(R.id.item_price);
view.setTag(holder);
}
holder = (ViewHolder) view.getTag();
Typeface face=Typeface.createFromAsset(context.getAssets(), "fonts/roboto.ttf");
holder.title.setTypeface(face, Typeface.BOLD);
holder.title.setText(items.get(i).getName());
holder.title.setTextColor(Color.parseColor(Shop.getInstance().getItemGridTextColor()));
holder.price.setText(Global.getLocalizedPriceStringByLocale(Shop.getLocale(), items.get(i).getPrice()));
holder.price.setTextColor(Color.parseColor(Shop.getInstance().getItemGridTextColor()));
return view;
}
public class ViewHolder {
public TextView title;
public TextView price;
}
}
(This adapter takes item's title and price and puts them in first view.)
My second adapter which create second view is here;
public class CategoryListAdapter extends BaseAdapter {
private Context context;
//private ArrayList<Item> items;
private ArrayList<Category> currentCategory;
public CategoryListAdapter(Context context, ArrayList<Category> category) {
super();
this.context = context;
currentCategory = category;
}
public int getCount() {
return currentCategory.size();
}
public Object getItem(int i) {
return currentCategory.get(i);
}
public long getItemId(int i) {
return i;
}
public View getView(final int i, View view, ViewGroup viewGroup) {
ViewHolder holder;
if (view == null) {
holder = new ViewHolder();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.grid_list_layout, null);
holder.title = (TextView) view.findViewById(R.id.categories_title_list_layout);
holder.gridView = (GridView) view.findViewById(R.id.gridView_list_layout);
holder.note = (TextView) view.findViewById(R.id.categories_note);
view.setTag(holder);
}
holder = (ViewHolder) view.getTag();
Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts/roboto.ttf");
holder.title.setTypeface(face, Typeface.BOLD);
if(currentCategory.get(i).getName().equals("")){
holder.title.setText("Diğer");
}else{
holder.title.setText(currentCategory.get(i).getName());
}
holder.title.setTextColor(Color.parseColor(Shop.getInstance().getItemGridTextColor()));
holder.note.setText(currentCategory.get(i).getDeepNote());
holder.note.setTextColor(Color.parseColor(Shop.getInstance().getItemGridTextColor()));
holder.gridView.setAdapter(new ItemListAdapter(context, currentCategory.get(i).getItems()));
holder.gridView.setBackgroundColor(Color.parseColor(Shop.getInstance().getItemGridBackgroundColor()));
holder.gridView.getBackground().setAlpha(180);
return view;
}
public class ViewHolder {
public TextView title;
public GridView gridView;
public TextView note;
}
}
And I use this adapter to create ListView.
Here is my problem. This works really slow. I mean ListView freezes for a moment then slide down when I try to move down.
And there is another problem about GridView's height. My GridView's height is wrap_content but it doesn't behave like wrap_content. It shows bigger or smaller GridView.
For example; under "Diğer" title there should be a GridView which contains only 1 item as you can see, but it can not show the complete text. And under "Adet Ürünler" there should be 190 items but it only views 20 of them.
These are my problems. Sorry for my coding. If you can not understand my code, please ask me.
Thanks for your helps.
This answer won't give you a definitive solution, not because I'm not willing, but because it's impossible (and even harder without not just viewing your code, but knowing it very well). But from my experience I can tell you that those kind of memory leaks doesn't occur just due to directly referenced objects - objects you declare (and keep referencing another classes/objects) in turn depends on many other classes and so on, and probably you're seeing a memory leak due to an incorrect handling of any of your instances which at the same time reference other instances.
Debugging memory leaks is a often a very hard work, not just because as I said above it sometimes doesn't depend directly on what you've declared, but also because finding a solution might not be trivial. The best thing you can do is what you already seem to be doing: DDMS + HPROF. I don't know how much knowledge you have, but although it's not a universal method, this link helped me so much to find memory leaks in my code.
Although it seems trivial, the best way to debug those kind of things is progresively remove portions of your code (overall, those which implies working with instances of other classes) and see how the HPROF report change.
as far as i understand your problem, it's low performance during scrolling the list you've shown in the screenshot?
a solution to your problem would need you to rewrite your adapter and layouts. Your performance problem is due to the rather large list-items you use (e.g. a grid inside a single list item with 190 items), that have to be loaded during scrolling the list, together with a rather low re-usability of list-items.
in addition, i prefer not to use view-holders.
To get rid of the grids, you could use a list of objects (or wrappers like shown below), that contains the 'title', 'note' and the single grid rows in between. you would have to overwrite some of the adapters methods, to use multiple viewtypes inside one listview (like shown below).
perhaps you'll also need some more code, to map your model into the new list, but after all, your performance should be back to normal.
only disadvantage i know of (and have no fast solution for) is due to the different height in single list items, the scrollbar of the whole list shows sometimes a strange behaviour (like: height of scrollbar indicator changes during scroll)
wrapper
public class ListItemWrapper {
ListItemType type;
Object content;
public ListItemWrapper(ListItemType type, Object content) {
this.type = type;
this.content = content;
}
public enum ListItemType { Title,Note, Content;}
}
ListAdapter
public class ListAdapter extends ArrayAdapter<ListItemWrapper> {
private LayoutInflater inflater;
public ListAdapter(Context context, int resource) {
super(context, resource);
inflater = LayoutInflater.from(context);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
ListItemWrapper item = getItem(position);
switch (item.type) {
case Content: return getViewForGridRow((GridRowContent)item.content, convertView);
case Note: return getViewForNote((String)item.content, convertView);
case Title: return getViewForTitle((String) item.content, convertView);
}
return convertView; //this case should never happen
}
private View getViewForTitle(String content, View convertView) {
if (convertView == null) {
//TODO inflate a new view for the title
convertView = inflater.inflate(R.layout.titleRowLayout, null);
}
//TODO set textview value for the title
return convertView;
}
private View getViewForNote(String content, View convertView) {
if (convertView == null) {
//TODO inflate a new view for the note
convertView = inflater.inflate(R.layout.noteRowLayout, null);
}
//TODO set textview value for the note
return convertView;
}
private View getViewForGridRow(GridRowContent item, View convertView) {
if (convertView == null) {
//TODO inflate a new view for a single grid row
convertView = inflater.inflate(R.layout.gridRowLayout, null);
}
//TODO set values of the grid row (e.g. textview items)
return convertView;
}
#Override
public int getItemViewType(int position) {
return getItem(position).type.ordinal();
}
#Override
public int getViewTypeCount() {
return ListItemType.values().length;
}
}
I simplified parts of the model, but i hope you'll get the point.
as you can see, i don't use a custom BaseAdapter, since the arrayadapter already manages my collection. i only need to tell the list, that there are different item view types and which item in the collection uses which view type.
Additionally, there's no need to use any holders, since all holding and managing the different views is already done by the adapter - e.g. we only need to inflate views if the given convertView is not already cached within the adapter.
using this way should be much more memory efficient and performance should increase, since much less views have to be inflated in a single step.
I hope this helps,
Christian
Edit
can't explain the disapearing gridview in the center, but that shouldn't happen anymore
I'm trying to implement the ViewHolder pattern with convertView. Two questions:
1) When I comment lines #1 and #2 (which are required for the pattern) everything works fine. When the if is in place everything gets scrambled, the first element of the list gets shown twice (in the beginning and in the end of the list) and after some orientation changes and list scrolling everything gets jumbled. Why is this happenning?
2) I'm using a ListActivity and providing the TextView and array of Strings for the ArrayAdapter (#3) but for some reason I still need line (#4) otherwise the list items are blank. Is this because i'm not using super.getView()?
class SushiAdapter extends ArrayAdapter<String> {
private final Activity context;
SushiAdapter(Activity context) {
super(context, R.layout.row, R.id.label, MenuItems); // #3
this.context = context;
}
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
if (row == null) { //#1
LayoutInflater inflater = context.getLayoutInflater();
row = inflater.inflate(R.layout.row, parent, false);
ViewHolder holder = new ViewHolder();
holder.icon = (ImageView) row.findViewById(R.id.icon);
holder.position = position;
holder.item = (TextView) row.findViewById(R.id.label);
row.setTag(holder);
} // #2
ViewHolder newHolder = (ViewHolder) row.getTag();
newHolder.item.setText(MenuItems[newHolder.position]); // #4
newHolder.icon.setImageResource(R.drawable.sushi);
return row;
}
}
If you are creating a new instance of array adapter, for example:
ArrayAdapter<T> sushiAdapter = new ArrayAdapter<T>(context, R.layout.row, R.id.label, MenuItems)
this instance already has it's own implementation of getView method. So it's obvious that in your case when override getView, you provide the complete implementation by yourself and take all responsibilities for filling views with content.
So if you want to add add something new, please call super.getView() before.
But in your case, when you have Image + text view you need to extend BaseAdapter and provide all implementation by yourself. ArrayAdapter provides simple functionality and extending it is not a common practice.
I have a listview which loads its data from sqlite database.
Each row in listview has image , textview and a checkbox.
The sqlitedatabase rows has image and text data + some other columns.
My question is can I bind my listview with the database so that all rows will be loaded with required data automatically. (image + textview) There are examples to bind a simple list of textviews. What about complex rows ? Also there are few spinners which can filter the data in list depending on its value. (Which act as a WHERE clause on my DB)
Currently I am managing this all by generating the view for my custom adapter for each row. So each time I query database and populate data. I hold the last listview results , make a newer results based on actions/conditions like spinner values, then notifydatachanged to adapter to load my new results.
To add features like DELETE , ADD , SEARCH -- I have to manage it all using collections.
Is there any simple way of doing this ? As if the db is large then the approach of holding such huge set of results in memory is not good. And is painful for managing it.
Thanks.
Here is my example for row, constructed from two records from db + image (at current - one image for any row, but it can be improved for specific image from db):
public class DomainAdapter extends SimpleCursorAdapter{
private Cursor dataCursor;
private LayoutInflater mInflater;
....
public DomainAdapter(Context context, int layout, Cursor dataCursor, String[] from,
int[] to) {
super(context, layout, dataCursor, from, to);
this.dataCursor = dataCursor;
mInflater = LayoutInflater.from(context);
}
public View getView(int position, View convertView, ViewGroup parent) {
// A ViewHolder keeps references to children views to avoid unneccessary calls
// to findViewById() on each row.
ViewHolder holder;
// When convertView is not null, we can reuse it directly, there is no need
// to reinflate it. We only inflate a new View when the convertView supplied
// by ListView is null.
if (convertView == null) {
convertView = mInflater.inflate(layout, null);
// Creates a ViewHolder and store references to the two children views
// we want to bind data to.
holder = new ViewHolder();
holder.text1 = (TextView) convertView.findViewById(R.id.test_track);
holder.text2 = (TextView) convertView.findViewById(R.id.test_band);
holder.icon = (ImageView) convertView.findViewById(R.id.test_artwork);
convertView.setTag(holder);
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
}
// Bind the data efficiently with the holder.
// Cursor to current item
dataCursor.moveToPosition(position);
int title_index = dataCursor.getColumnIndex(fields[0]);
String title = dataCursor.getString(title_index);
int description_index = dataCursor.getColumnIndex(fields[1]);
String description = dataCursor.getString(description_index);
holder.text1.setText(title);
holder.text2.setText(description);
holder.icon.setImageResource(R.drawable.alert_dialog_icon);
return convertView;
}
static class ViewHolder {
TextView text1;
TextView text2;
ImageView icon;
}
}
and using this adapter:
databaseListAdapter = new DomainAdapter(this,
R.layout.test_layout,
databaseCursor,
new String[] {"title", "description"},
new int[] { R.id.test_track, R.id.test_track });
databaseListAdapter.notifyDataSetChanged();
DomainView.setAdapter(databaseListAdapter);
and layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="64dip"
android:padding="6dip">
<TextView
android:id="#+id/test_band"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_below="#+id/test_track"
android:layout_alignLeft="#id/test_track"
android:layout_alignParentBottom="true"
android:gravity="top" />
<TextView
android:id="#id/test_track"
android:layout_marginLeft="6dip"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_toRightOf="#+id/test_artwork"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="bottom" />
<ImageView
android:id="#id/test_artwork"
android:layout_width="56dip"
android:layout_height="56dip"
android:layout_gravity="center_vertical" />
</RelativeLayout>
My question is can I bind my listview
with the database so that all rows
will be loaded with required data
automatically. (image + textview)
There are examples to bind a simple
list of textviews. What about complex
rows ?
Yes, you can do a Cursor to complex view mapping by implementing your own CursorAdapter and overriding the bindView().