OutOfMemory problem

by Kofa » Sun, 18 Apr 2010 17:50:22 GMT

Sponsored Links
 I really don't know why it's giving me this error...
I load an ImageView with an image of 692kb .jpg, using scroll options,
so you can scroll it around... the strange it's that when the mobile
it's connected to the VM it's less possible to happen.
So...how can I prevent this? is there anyway that I can free memory
when starting the app? can I tell the system to free memory before
loading the image? please show me the path =P....thx a lot!


OutOfMemory problem

by Streets Of Boston » Sun, 18 Apr 2010 23:59:28 GMT

 How big, in pixels, is the image?


Sponsored Links

OutOfMemory problem

by patbenatar » Mon, 19 Apr 2010 17:36:16 GMT

 You say your error doesn't happen as often if you are plugged into
your computer? Is that what you mean by VM? If so, that's likely
because you're developing your code at the time and every time you run
it on the device it kills and restarts your process.. leaving little
time for memory leaks to lead to OutOfMemory errors. Just FYI.

As for your OutOfMemory errors, this can be a really tough one to
debug.. Your app is leaking memory somewhere, but its hard to say
where. The image is not necessarily the problem, it could simply be
the tipping point that finally forces your app to crash. I would
recommend reading over all the articles tagged "Optimization" over at


> >

OutOfMemory problem

by Kofa » Thu, 22 Apr 2010 02:56:07 GMT

 I'm looking at this blog about Optimization, thanks patbenatar.
The image it's 1920x1440 pixels, hope it helps.


OutOfMemory problem

by Kofa » Thu, 22 Apr 2010 02:57:22 GMT

 the image it's 1920x1440 pixels

> >

OutOfMemory problem

by Streets Of Boston » Thu, 22 Apr 2010 03:41:21 GMT

 1920p * 1440p * 2Bytes/p = 2764800*2 = 5529600 Bytes per image.

That's a big chunk and only a one time leak could cause your memory
Track your code and see where you possibly cache the reference to this
large Bitmap.
Note that memory used by Bitmaps (the internal array of bytes) is not
part of the DalvikVM and won't show up when you do java memory
profiling. However, this memory is part of the overall memory used by
the app's process.

> > >

Other Threads

1. Failure to connect to camera service.


I'm trying to write a basic camera app. The problem that I am facing
is that it works fine in emulator but on the phone (Nexus one) it

The point of failure is the very first call, i.e. Camera.open(). It
fails on the phone saying "Failed to connect to camera service". Any
idea what could be wrong? (BTW, I am calling this from my activity's
onCreate funtion itself, could that be an issue?)

For the information, I do have the necessary Camera permissions
specified in my manifest xml file.



2. Issues with httppost: Authentication challenge is empty

Hey everyone,

I'm developing an Android app which needs to perform an HTTPPost to
get a token back. Then use that token for subsequent calls.  When I
perform the initial call to get the token, it throws an exception:

    org.apache.http.auth.MalformedChallengeException: Authentication
challenge is empty

Here is my code:

    DefaultHttpClient httpclient = new DefaultHttpClient();
AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new
UsernamePasswordCredentials("username", "password"));

    HttpPost httppost = new HttpPost(authenticationURL);
    httppost.addHeader("app_key", app_key);

    String strResponse = "";
    try {
     HttpResponse response = httpclient.execute(httppost);  <---
exception thrown here
     HttpEntity entity = response.getEntity();

     if (entity != null) {
          InputStream instream = entity.getContent();
          strResponse = convertStreamToString(instream);

     JSONObject jObject=new JSONObject(strResponse);
     wrapAccessToken = jObject.getString("wrap_access_token");
     } catch (ClientProtocolException e) {
     } catch (IOException e) {
     } catch (JSONException e) {

I googled "Authentication challenge is empty", and one this website:
he had a similar problem.  He determined that his web server requires
preemptive authentication.  Which I believe ours does too.  I tried
implementing what he did, and still, no dice.

I've hard coded the token in other requests, and I am able to perform
HTTPGet calls.

What am I doing wrong?   What is the Authentication Challenge that I'm

Thanks in advance


3. Finding the View that has current focus


5. Black screen with mouse cursor appearing on each activity change with froyo-2.2

6. SharedIDs

7. Samsung Galaxy Tab AVD reports trackball