How to "kill" an activity to avoid the memory usage?

MaxNunezMaxNunez CRMember ✭✭

How to "kill" an activity to avoid the memory usage?

Posts

  • BrianBirdBrianBird USUniversity ✭✭

    Is there a reason you want your code to explicitly remove an activity from memory? When system memory is needed, the Android system will automatically remove any paused or stopped activities from memory.

  • MaxNunezMaxNunez CRMember ✭✭
    edited October 2013

    I have problems about memory . We have 21 activities and when I use a lot the app, the device starts to respond slowly and in one moment show message of "range out memory" o something like that and I can't continue using the app. I use sqlite database and I'm looking the best way to avoid that because the issue is when I want to load other activity again. I'm using global variables to pass the data of an activity to other.

  • TomOpgenorthTomOpgenorth CAXamarin Team Xamurai
    edited October 2013

    Generally speaking you call Finish(), consider this method in an activity:

    void StartNextActivity() 
    {
        var intent = new Intent(this, typeof(NextActivity));
        StartActivity(intent);
        Finish();
    }
    
  • BrianBirdBrianBird USUniversity ✭✭

    You could have your Activity call finish()
    This might cause the system to free memory more quickly. (I'm just guessing about this.)

Sign In or Register to comment.