Loading Partial Subset of a Bitmap

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Loading Partial Subset of a Bitmap

Postby Ravenize » Sat Feb 07, 2009 9:42 pm

Hey all, I have a new issue I'm dealing with. So I have a huge image (2000 x 2000) that is way to big for the Android VM to load in (there's a 16 MB limit per application). That's fine with me, as I only want to load in one screen size (320 x 480) at a time, which Android should more than be able to handle. The problem is, how do you load in just one piece of a bitmap? I've tried the following:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Bitmap bmp1 = BitmapFactory.decodeResource(res, R.drawable.);
  3.  
  4. Bitmap bmp2 = Bitmap.createBitmap(bmp1, 0, 0, 320, 480);
  5.  
  6.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


But of course the loading is really done in that first line, so the VM crashes.

Any ideas?
Ravenize
Freshman
Freshman
 
Posts: 3
Joined: Thu Jan 22, 2009 9:44 am

Top

Postby MrSnowflake » Sun Feb 08, 2009 1:19 pm

Make your own loading routine
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby kali » Thu Feb 12, 2009 9:30 am

hai ravenize
i m fresher at android would you send code for puttong jpg image in my application :roll:
kali
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Tue Jan 27, 2009 1:31 pm

Postby jasont » Thu Feb 12, 2009 8:01 pm

Why do you have an image that is 2000x2000, what is it?
jasont
Developer
Developer
 
Posts: 28
Joined: Mon Sep 22, 2008 6:39 pm
Location: California

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests