I have My first Activity - [A] and my Second Activity [B]. I Starting my transparent-[B] Activity from Activity [A] in my PreExecute of BackGroundTask using
Intent intent = new Intent(ActivityA.this, ActivityB.class);
startActivity(intent);
and from my PostExecute i want to close my transparent Activity [B] to continue work with Activity [A] like:
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
but it give's me Error cause i haven't an correct Intent.
i can do like:
Intent intent = new Intent(getAplicationContext(), ActivityA.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
This code will create a new Activity [A]. But i need to continue my work with Activity[A] not to create a new Activity [A]. How can i finish() Activity[B] from Activity[A] without errors, go back to Activity[A] and continue my work.
private class BackGroundTask extends AsyncTask<Void, Void, Void>
{
@Override
protected void onPreExecute()
{
StartPreExecute();
}
@Override
protected Void doInBackground(Void... params)
{
//sending request to server and waiting response here
return null;
}
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
StartPostExecute();
}
}
protected Void doInBackground(Void... params)
{
return null;
}
private void StartPreExecute()
{
Intent intent = new Intent(SigninActivity.this, LoadingLayout.class);
startActivity(intent);
}
private void StartPostExecute()
{
Intent intent = new Intent(getAplicationContext(), SigninActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_);
startActivity(intent);
}