Hi,
I'm in trouble to fire dialog from custom list adapter.
The list item consists of 2 TextView and 1 ImageView. It's similar to
the Android phone's account setting
(http://developer.android.com/resources/samples/images/
SampleSyncAdapter1.png)
I remember that the dialogs are only invoked in Activity class, but
BaseAdapter is not inherit from Activity.
I want to fire a dialog when I touch ImageView, so I wrote my code
(from API Demo - Efficient List) below..
I don't know how to fire a dialog...
......
private static class EfficientAdapter extends BaseAdapter {
....
/**
* Make a view to hold each row.
*
* @see android.widget.ListAdapter#getView(int,
android.view.View,
* android.view.ViewGroup)
*/
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(R.layout.list_item_icon_text, null);
// Creates a ViewHolder and store references to the
two children views
// we want to bind data to.
holder = new ViewHolder();
holder.textGoal = (TextView)
convertView.findViewById(R.id.textGoal);
holder.textPriority = (TextView)
convertView.findViewById(R.id.textPriority);
holder.icon = (ImageView)
convertView.findViewById(R.id.iconSetting);
holder.icon.setOnClickListener(new OnClickListener()
{
public void onClick(View v) {
}
});
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.
holder.textGoal.setText(DATA[position]);
holder.icon.setImageBitmap(mIcon1);
return convertView;
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en