OutOfMemoryError when starting Activity a few times

2

I'm developing my software engineering project that consists of an Android application and I'm having a problem transitioning between Activity.

The problem is based on two screens:

Login screen, consisting of:

  • Image (logo)
  • Email field
  • Password field
  • Sign up
  • I forgot my password

Password recovery screen, consisting of:

  • Email field
  • Upload send

Okay, when I press the Submit button on the recovery screen, I'm redirected to the login screen. Alas that is the problem, if I do this three times the application stops working.

Flow: Login > Recovery > Login > Recovery > Login > Recovery > Login ERRO

This is the way I'm using to make the transition between one activity and another. I do not know if this is the right one, causing Activity to pause and the other to summarize.

Intent intentLogin = new Intent(RecuperarActivity.this, MainActivity.class);
startActivity(intentLogin);

This is the error generated:

java.lang.OutOfMemoryError: Failed to allocate a 24582668 byte allocation    with 16777120 free bytes and 16MB until OOM

It seems like he's sort of re-allocating activity. I ran a test and the onResume method is called normally. The other parts of the bug talk about BitmapFactory has to do with the image it should weigh, but even then I should be able to open a screen as many times as I want.

Thank you in advance!

    
asked by anonymous 03.04.2016 / 22:22

0 answers