Hello,
I have implemented the following Adapter class which also implements
onitemclicklistener.
My problem is, that when I click on one item in the list, the
onItemClick function is not invoked.
What is wrong ?
public class MovieListAdapter implements ListAdapter,
OnItemClickListener {
private Context mContext;
private ArrayList<MovieCatPackage> mMovPackArray = new
ArrayList<MovieCatPackage>();
private HashSet<DataSetObserver> observers = new
HashSet<DataSetObserver>();
public MovieListAdapter(final Context context) {
this.mContext = context;
}
public MovieListAdapter(final Context context,
ArrayList<MovieCatPackage> packageArray) {
this.mContext = context;
this.mMovPackArray = packageArray;
}
@Override
// usual functions for listadapter........
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View v;
if (convertView == null)
v = View.inflate(mContext,
who.cares.R.layout.Movieitempackage, null);
else
v = convertView;
MovieCatPackage movPack = this.mMovPackArray.get(position);
TextView category = (TextView) v.findViewById
(who.cares.R.id.Movieitempackage_Category);
category.setText(movPack.getCategory());
ListView details = (ListView) v.findViewById
(who.cares.R.id.Movieitempackage_Details);
details.setOnItemClickListener(this);
MovieItemAdapter movItemAdapter = new MovieItemAdapter(mContext,
movPack.getdetails());
details.setAdapter(movItemAdapter);
return v;
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
Log.d("TEST", "TEST");
}
}
Movieitempackage.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#991111"
android:layout_weight="0">
<TextView android:id="@+id/Movieitempackage_Category"
android:textColor="#FFFFFF"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="_category"/>
</LinearLayout>
<ListView android:id="@+id/Movieitempackage_Details"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---