You array adapter has extended "ArrayAdapter<FuItem>": public class FuItemAdapter extends ArrayAdapter<FuItem>
Your ArrayAdapter is expecting type FuItem, your overridden OnItemClick function isn't being called because the AdapterView's type isn't explicit maybe? So try AdapterView<FuItem> arg0 instead of AdapterView<?> arg0 I'm a C programmer first so I could be totally off. I'm always hammering strangely shaped pegs into the wrong holes here. :) On Sep 21, 2:47 am, "lf.hl" <flod...@googlemail.com> wrote: > Hi Joy, > > thanks for your response. I see the OnClickListeners for the button > and edittext firing (the one i have registered in the adapter). I > don't see the OnItemClickListener in the AdapterTest.class. > > Thanks again and best, > > lf.hl > > On 21 Sep., 02:17, Joy <3crownt...@gmail.com> wrote: > > > Hi, > > You bind onItemClick twice. Did you see any log when item is clicked? > > > On Sun, Sep 20, 2009 at 5:09 AM, lf.hl <flod...@googlemail.com> wrote: > > > > Hi, > > > > in a custom ArrayAdapter i don't see onItemClick firing. I would like > > > to pack all the logic in there so i need access to the views in each > > > row of the adapter (2 Buttons,1 EditText). I was looking on the > > > internet for hours to find a real howto. > > > > Q1: Is there a tutorial on the net? > > > Q2: Do you see a bug/whats missing? > > > Q3: How to seduce a clicked View in onItemClick? > > > > Any help is really really appreciated, > > > > lf.hl > > > > ----------This is the activity----------- > > > package org.rice; > > > > import android.app.Activity; > > > import android.view.View; > > > import android.view.View.OnClickListener; > > > import android.widget.*; > > > import android.os.Bundle; > > > import java.util.*; > > > import android.widget.AdapterView.OnItemClickListener; > > > import android.util.*; > > > > public class AdapterTest extends Activity{ > > > private ArrayList<FuItem> fItems; > > > private ArrayAdapter<FuItem> aa; > > > private ListView myListView; > > > > private void fillit(){ > > > fItems = new ArrayList<FuItem>(); > > > > for(int i = 0; i < 5; i++){ > > > FuItem fi = new FuItem(String.valueOf(i), > > > (float)i); > > > fItems.add(fi); > > > } > > > } > > > /** Called when the activity is first created. */ > > > �...@override > > > public void onCreate(Bundle savedInstanceState) { > > > super.onCreate(savedInstanceState); > > > setContentView(R.layout.main); > > > > myListView = (ListView)findViewById(R.id.liste); > > > > fillit(); > > > > int resId = R.layout.row; > > > aa = new FuItemAdapter(this, resId, fItems); > > > > myListView.setAdapter(aa); > > > > myListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); > > > myListView.setItemsCanFocus(true); > > > > myListView.setOnItemClickListener(new OnItemClickListener() { > > > > �...@override > > > public void onItemClick(AdapterView<?> arg0, View > > > arg1, int arg2, > > > long arg3) { > > > // TODO Auto-generated method stub > > > Log.i("adaptertest", "onItemClick fired"); > > > } > > > > }); > > > } > > > } > > > > -------------Custom Adapter FuItemAdapter--------------- > > > > package org.rice; > > > > import android.view.*; > > > import android.view.View.OnClickListener; > > > > import android.widget.*; > > > import android.content.Context; > > > import java.util.*; > > > import android.util.*; > > > import android.widget.Button; > > > > public class FuItemAdapter extends ArrayAdapter<FuItem> { > > > > int resource; > > > > public FuItemAdapter(Context _context, int _resource, List<FuItem> > > > _items) { > > > super(_context, _resource, _items); > > > resource = _resource; > > > } > > > > �...@override > > > public View getView(int position, View convertView, ViewGroup > > > parent) > > > { > > > LinearLayout fuitemView; > > > > FuItem item = getItem(position); > > > > String productString = item.getProduct(); > > > String priceString = String.valueOf(item.getPrice()); > > > > if(convertView == null){ > > > fuitemView = new LinearLayout(getContext()); > > > String inflater = Context.LAYOUT_INFLATER_SERVICE; > > > LayoutInflater vi; > > > vi = > > > (LayoutInflater)getContext().getSystemService(inflater); > > > vi.inflate(resource, fuitemView, true); > > > } > > > else { > > > fuitemView = (LinearLayout) convertView; > > > } > > > > TextView productView = (TextView)fuitemView.findViewById > > > (R.id.product); > > > EditText priceView = > > > (EditText)fuitemView.findViewById(R.id.price); > > > Button down = (Button)fuitemView.findViewById(R.id.down); > > > Button up = (Button)fuitemView.findViewById(R.id.up); > > > > down.setOnClickListener(new OnClickListener() { > > > �...@override > > > public void onClick(View v) { > > > > Log.i(getClass().getSimpleName(),"button onclick > > > fired:" ); > > > } > > > }); > > > > up.setOnClickListener(new OnClickListener() { > > > �...@override > > > public void onClick(View v) { > > > Log.i(getClass().getSimpleName(),"button onclick > > > fired"); > > > } > > > }); > > > > priceView.setOnClickListener(new OnClickListener() { > > > �...@override > > > public void onClick(View v) { > > > Log.i(getClass().getSimpleName(),"button > > > onclick fired"); > > > } > > > }); > > > > priceView.setFocusable(true); > > > down.setFocusable(true); > > > > productView.setText(productString); > > > priceView.setText(priceString); > > > > return fuitemView; > > > } > > > > public boolean areAllItemsSelectable() { > > > return true; > > > } > > > } > > > -- > > Best Regards, > > Joy > > > Aurora Device Search - The Real Android Universal Search > > Enginehttp://android-aurora.appspot.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---