Without showing too much code:
I have an Activity “A”. This Activity populates a ListView via a BaseAdapter,
the BaseAdapter‘s getView() sets an onClickListener() for an item in every row.
I want to show an AlertDialog in Activity “A” when the rows’ item is clicked.
I don’t see where you encounter problems. If you have your
BaseAdapterversion in theActivityA then you could simply call(in theOnCLickListenerfor that row’s item that you set in thegetViewmethod of theBaseAdapter) a private method that you create in the AActivity:If your custom
BaseAdapterisn’t in the same file asActivityA then you could use theContextthat you passed to theBaseAdapter(if the code for your adapter is the one from your previous question, if not you should pass it in the constructor). You could then cast thatContextto your activity and call the previous methodshowADialog(). Also when you set the listener you should pass thepositionas a tag so you can retrieve it in theOnCLickListener(otherwise you could get the wrong position as the views + listener get recycled):