I read lots of questions about it and anyone fix my problem. I have an AsyncTask where a new activity must be started. The code is the following:
public class UpdateCatalog extends AsyncTask <Void,Integer,Void> {
private Context context;
private LoadActivity activity;
public UpdateCatalog(LoadActivity activity) {
super();
this.activity = activity;
this.context = this.activity.getApplicationContext();
}
.
.
.
@Override
protected void onPostExecute(final Void result) {
// Update your views here
LoadActivity.progressStatus.setVisibility(View.GONE);
context.startActivity(new Intent(context, DownloadImages.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
}
The call to this AsincTask is in the Activity which started the AsincTask and is like following:
public class LoadActivity extends AppCompatActivity {
public static TextView txtStatus;
public static ProgressBar progressStatus;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_load);
txtStatus = (TextView) findViewById(R.id.progressStatus);
progressStatus = (ProgressBar) findViewById(R.id.progressBar);
if(CheckCatalog()){
ShowUpdateDialog();
}
else
new UpdateCatalog(this).execute();
}
The error is the following:
FATAL EXCEPTION: main
android.content.ActivityNotFoundException: Unable to find explicit activity class {es.aplicaciones.alvaro.entrelazadas/es.aplicaciones.alvaro.entrelazadas.DownloadImages};
The DownloadImages.class is already created. So I think it is not the problem. I try with other ways pasing the context as parameter but it still not working. Please can you help me?