1

How to start an activity from inside ArrayAdapter and get a call back when the activity is finished(just like onActivityResult)?

Following code is on post execute of an asynctask that is started on the button click of a button displayed in each listview row.

((Activity) mContext).startActivityForResult(intent, AppConstants.DUMMY_CONSTANT);
Ramya BA
  • 123
  • 2
  • 8

2 Answers2

0

If it's possible, try using this instead:

listView.setOnItemClickListener(new OnItemClickListener() { ... });

Edit. You can also create interface, implement it in your acitvity and pass it to your adapter

Raphau
  • 116
  • 5
0
My Pscudoe code:-- Create call back method using interface 
and make call back wherever you want
MyListener listener;

  public interface MyListener {
    // TODO: Update argument type and name
    void onClick(View view, int position);
}


@Override
public void onClick(View view) {
    listener.onCardClick(view, getPosition());
}

From Listview onitem:---