0

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?

Amit Yadav
  • 32,664
  • 6
  • 42
  • 57
Álvaro
  • 1
  • 3

2 Answers2

1

Remember, you have to declare each activity in the AndroidManifest.xml file :)

<activity android:name=".DownloadImages" />
Arturo
  • 548
  • 6
  • 15
  • Thanks, it was the problem, I waste around 2 hours trying to fix it and the solution was very simple but i didn't think about it! Thanks a lot – Álvaro Aug 27 '15 at 13:17
1

Check your manifest file. If your DownloadImages class is in the "base" package which is declared in manifest file then add the activity with .ClassName

<application> 
....
     <activity android:name=".DownloadImages" />
</application>

else write full path to your DownloadImages class.

 <application> 
    ....
         <activity android:name="com.example.path.DownloadImages" />
 </application>