When I am in a fragmentB, how to simulate a click on a button located in an activity in the stack.
LoginActivityA => fragmentB.
I want to simulate something like this:
LoginActivityA.btnClick() from the fragmentB
I tried to use this tickets with no success: Ticket1, Ticket2, Ticket3
Here is my code:
FragmentB:
//BEGIN TEST
String message="hello ";
Intent intent = new Intent(getActivity(), LoginActivity.class);
intent.putExtra("MESSAGE",message);
getActivity().setResult(2,intent);
getActivity().startActivityForResult(intent,2);
getActivity().finish();//finishing activity
//END TEST
LoginActivityA:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
// check if the request code is same as what is passed here it is 2
if(requestCode==2)
{
//do the things u wanted
}
}
I precise that I try not to get multiple LoginActivity and Fragment launched. I would like to get only one stack with LoginActivity => Fragment
Any ideas?
EDIT:
I tried this from this tichet with no success:
((LoginActivity)getActivity()).login();
I launched the activity function from the presented fragment with an error
"No acceptable module found. Local version is 0 and remote version is 0."