Question on memory management in android

by Anton S. » Wed, 05 Jan 2011 03:01:52 GMT


Sponsored Links
 Hi,
I have a single image that is slightly larger than the android screen
which I load into a ScrollView.

My question is the following:

Does android load the entire image into memory even though parts of it
are invisible(need to be scrolled to),
or does it use some kind of external/internal cache to store parts of
the image that are not
currently visible? If not, do you think it would be possible to
implement something like this.

Thanks!!

-- 



Re: Question on memory management in android

by Doug » Thu, 06 Jan 2011 08:51:12 GMT


 Bitmaps are going to take as much memory as they need for the grid of
pixels they represent.  If you want to store a giant image into a
giant bitmap (or even if you just want to create a giant empty bitmap)
you will consume that memory.

Android doesn't do so well with giant bitmaps that come and go because
they don't get garbage collected in the way you'd expect, and you'll
often run into memory problems if you attempt this.  It's a really
hairy topic with a lot of prior conversation around it that you can
easily search and find.

Doug




-- 


Sponsored Links


Re: Re: Question on memory management in android

by Anton S » Fri, 07 Jan 2011 02:32:30 GMT


 Alright, so that means it does load the entire image into memory.

I guess I'll try to break up my image and only load parts of it as they are
needed.


Thanks for you input Doug!






-- 



Other Threads

1. Problem with viewing map in tabhost

Hi,

I created an application that uses the TabHost to show 3 tabs, the tabs showing 
an AnalogClock (widget) and ListView are working, but the tab that should show 
the MapView returns an 'java.lang.VerifyError'  when it is selected.  The Api 
key provided is correct, it is based on the debug.keystore and works in other 
applications.

Can anyone give a hint on what I am doing wrong?

Cheers,
Friso

My code is as follows:
      public void onCreate(Bundle icicle) {
            super.onCreate(icicle);
            setContentView(R.layout.main);

            final TabHost tabs=(TabHost)findViewById(R.id.tabhost);

            tabs.setup();

            TabHost.TabSpec mapSpec=tabs.newTabSpec("tag1");
            mapSpec.setContent(new TabHost.TabContentFactory() {
                  public View createTabContent(String tag) {
                        return(new MapView(Pidget.this, "ABCDEF............"));
                  }
            });
            mapSpec.setIndicator("Map");
            tabs.addTab(mapSpec);


            TabHost.TabSpec infoSpec=tabs.newTabSpec("tag1");
            infoSpec.setContent(new TabHost.TabContentFactory() {
                  public View createTabContent(String tag) {
                        return(new AnalogClock(Pidget.this));
                  }
            });
            infoSpec.setIndicator("Info");
            tabs.addTab(infoSpec);

            TabHost.TabSpec helpSpec=tabs.newTabSpec("tag1");
            helpSpec.setContent(new TabHost.TabContentFactory() {
                  public View createTabContent(String tag) {
                        return(new ListView(Pidget.this));
                  }
            });
            helpSpec.setIndicator("Help");
            tabs.addTab(helpSpec);
      }
}




Friso Kluit | Academic Staff
School of Information & Communications Technology
Republic Polytechnic
t: 3100 1797 | f: 6415 1310

P Do you really need to print this e-mail?


________________________________

Republic Polytechnic, 9 Woodlands Avenue 9, Singapore 738964 (Near Woodlands 
MRT/Interchange).
www.rp.sg<http://www.rp.sg> . Fax: +65 6415-1310 .

Republic Polytechnic, the first Institute of Higher Learning to fully adopt the 
Problem-Based Learning approach in Singapore, continues to strive towards best 
practices and maintain excellence in service standards with the following 
certifications: Singapore Innovation Class (SIC), Singapore Quality Class 
(SQC), People Developer Standards and QEHS (ISO 9001, 14001 and OHSAS 18001)
--------------------------------------------------------------------------------
CONFIDENTIALITY CAUTION: This message is intended only for the use of the 
individual or entity to whom it is addressed and contains information that is 
privileged and confidential. If you, the reader of this message, are not the 
intended recipient, you should not disseminate, distribute or copy this 
communication. If you have received this communication in error, please notify 
us immediately by return email and delete the original message. Thank you.




Friso Kluit | Academic Staff
School of Information & Communications Technology
Republic Polytechnic
t: 3100 1797 | f: 6415 1310

P Do you really need to print this e-mail?


________________________________

Republic Polytechnic, 9 Woodlands Avenue 9, Singapore 738964 (Near Woodlands 
MRT/Interchange).
www.rp.sg . Fax: +65 6415-1310 .

Republic Polytechnic, the first Institute of Higher Learning to fully adopt the 
Problem-Based Learning approach in Singapore, continues to strive towards best 
practices and maintain excellence in service standards with the following 
certifications: Singapore Innovation Class (SIC), Singapore Quality Class 
(SQC), People Developer Standards and QEHS (ISO 9001, 14001 and OHSAS 18001)
--------------------------------------------------------------------------------
CONFIDENTIALITY CAUTION: This message is intended only for the use of the 
individual or entity to whom it is addressed and contains information that is 
privileged and confidential. If you, the reader of this message, are not the 
intended recipient, you should not disseminate, distribute or copy this 
communication. If you have received this communication in error, please notify 
us immediately by return email and delete the original message. Thank you.

--~--~---------~--~----~------------~-------~--~----~

2. Favorites list

Hi all

I was wondering if anyone can point me in the right direction, I have
come across a very annyoing feature in the default dialer, it seem to
want to add anyone you call from your contacts list to the favorites
list, even if you call this person once, worse yet if the person calls
you and there name is in the phone book, they get added to your
favorites. Is there a way to programitcly access the Favorites list in
the dialer program and clear and or remove the names from that list.


any help would be appreciated.. Thanks

--~--~---------~--~----~------------~-------~--~----~

3. Browser extensions i Java? YES, NO, Some?

4. How to create a custom button

5. sdk activity life cycle picture inaccurate?

6. How to set up as a straight vertical display

7. G-cube?