this is my adapter
...
I need to make the three views inside this listview clickable....

This code is not working for me....
lv.setOnItemClickListener(new OnItemClickListener() {

(For reference in the future, please state what *actually* happened - even if the answer is 'nothing happened' - and if it isn't obvious, state what you expected to happen).

I would suggest temporarily removing your custom binder to see if that is interfering somehow. I know nothing about what binders are supposed to do (for now), but the following complete sample (based on your layouts and almost the exact same code you provided) worked just fine for me:

package net.testing;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.HashMap;

public class ListItemClickActivity extends Activity
{
private Activity m_thisActivity = null ;

   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState)
   {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       m_thisActivity = this ;

       // Dummy data for a single list item.
ArrayList<HashMap<String, String> > mylist = new ArrayList<HashMap<String, String> >();
       HashMap<String, String> entry = new HashMap<String, String>();
       entry.put("name","TestImage");
       entry.put("time","Now");
       entry.put("image","An image!");
       mylist.add(entry);

       ListView lv = ( (ListView)findViewById(R.id.listview1) );

       SimpleAdapter adapter=null;

adapter = new SimpleAdapter(ListItemClickActivity.this, mylist , R.layout.newslist,
                    new String[] { "name", "time","image"},
new int[] { R.id.newsName,R.id.newsTime,R.id.newsImage});
 //adapter.setViewBinder(new MyViewBinder());
 lv.setAdapter(adapter);

 lv.setOnItemClickListener(new OnItemClickListener()
 {
  @Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
  {
   Log.i("LOGCAT", "View " +arg1.getId());
Toast.makeText(m_thisActivity,"View " +arg1.getId(), Toast.LENGTH_SHORT).show();
   //Intent i=new Intent(getApplicationContext(),NewClass.class);
   //               startActivity(i);

  }

 } );

   }
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to