Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:19:13+00:00 2026-05-30T07:19:13+00:00

i am building an android application but i have some questions about the memory

  • 0

i am building an android application but i have some questions about
the memory usage.

Most of the data i need and use are string arrays stored in the xml strings file. I used arrays because firstly the biggest array will have up to 30 items and secondly there won’t be any updating or deleting or inserting items through the app.
All the custom adapters i created are following googles’ guidlines (the fast way – using the holder class)

As the user switches between the activities, depending on the selections he makes different arrays are loaded in the listviews.

Does android clears the memory each array allocates if its not in use? should i do that?
I ve used MAT also to check how the app uses memory and to check for leaks etc..and i thing that everything is fine. I also use a few png icons/images.
The app gets 5MB when it starts, goes up and down up to 8.5-9MB as the user plays around.

Thanks in advance for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:19:14+00:00Added an answer on May 30, 2026 at 7:19 am

    It’s possible the Android OS will kill your Activities (without focus) on the stack if memory is needed. When your Activity is killed in this way, onSaveInstanceState(Bundle outState) is called. You should save your string array here.

    When onCreate(Bundle savedInstanceState) is called in your Activity, if savedInstanceState is not NULL, then it means your Activity was previously killed by the OS and you need to repopulate your string array from that bundle.

    ex:

    String [] stringArray;
    ...
    
    protected void onCreate(Bundle savedInstanceState)
    {
        if (savedInstanceState != null)
        {
            stringArray = savedInstanceState.getStringArray("some_key");
        }
    }
    
    protected void onSaveInstanceState (Bundle outState)
    {
        super.onSaveInstanceState(outState);
        outState.putStringArray("some_key", stringArray);
    }
    

    This is described in more detail here: http://developer.android.com/reference/android/app/Activity.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been building an application on android and wanted to do some user
I have a webserver that hosts data for an application that I'm building on
I'm building an Android Application (minimum SDK Level 10, Gingerbread 2.3.3) with some Fragments
everyone. I am building an android application where I have obtain the latitude and
Hi all Im building a android application that requires data from a PHP server.
I'm building an application for android which collects user data. Also I'm going to
I'm building an Android application and I have preferences stored in classes loaded from
I am trying to use the titanium developer v.1.2.1 but i have some difficulty
I started doing some thinking about creating an Android application that can be used
I have an application building against Android 2.1 and I want to override the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.