Hope I'll succeed explain my situation the best.
I have an Activity (A) which is basically a Form to add a new item, with few text fields, time and location field. When clicking a setlocation button it invokes a second Activity (B) that has a list view with a customized ArrayAdapter which present suggestions for locactins. when clicking on one item (OnClickListener inside the adapter class) It need to pass it falue back to Activity A.
Call Activity B from A
Intent I = new Intent(getApplicationContext(), TaskGeoSetActivity.class);
startActivityForResult(I, LOC_ACTIVITY_CODE);
Setting the adapter inside Activity B
Adapter = new TaskGeoSubBaseAdapter(getApplicationContext(), R.id.sugtext, result);
Adapter.setActivity(TaskGeoSetActivity.this);
lv.setAdapter(Adapter);
OnClick Event within the adapter
public void setActivity(Activity act) {
parentAct = act;
}
private final OnClickListener locpicker = new OnClickListener() {
@Override
public void onClick(View v) {
Address a = items.get((Integer) v.getTag());
Intent intent = new Intent(context, TaskAddActivity.class);
intent.putExtra("Address", a);
parentAct.setResult(parentAct.RESULT_OK, intent);
}
};