Questions tagged [android-bitmap]

A Java Object from android.graphics.Bitmap that represents a Bitmap.

Use android.graphics.Bitmap to create an immutable bitmap image for Android.

Android supports bitmap files in three formats:

  1. .png (preferred),
  2. .jpg (acceptable),
  3. .gif (discouraged).

To find more information :

1782 questions
0
votes
1 answer

How to create the bitmap and decode it at the same time

I am creating a bitmap and it takes about 11 mb in the heap , though it is of the small size. Well I wanted to know if I can create the bitmap and also sclae it as a same time. The reason I want to do it is , the memory allocation , as If I…
Coas Mckey
  • 701
  • 1
  • 13
  • 39
0
votes
1 answer

Android View pager load image one by one on swipe through next page

I need to show 1000 images in viewpager from DB.The problem is if I fetch all images from DB and try to set those images to adapter,it shows Bitmap out of memory exception since heap size gets exceeded. So,I'm trying other way around which is to…
Vijay
  • 11
  • 3
0
votes
2 answers

Android : ArrayList with Bitmap from assets

I've been trying to do a list out of an images from the assets directory, and this is my code ArrayList list = new ArrayList<>(); try{ String[] PathFiles = assetManager.list("img"); for (int i = 0; i < PathFiles.length;…
0
votes
2 answers

Android: Managing bitmap arraylist efficiently without causing OutOfMemory exception

I am implementing a sketch-book in android. In this I have added a canvas. To show that users have multiple pages, when user clicks on next page I save the bitmap currently on canvas to a Bitmap ArrayList and clear the canvas for new bitmap. I am…
JCoder
  • 113
  • 1
  • 2
  • 9
0
votes
0 answers

Share a bitmap loaded in ram

is possible with Android, to share a bitmap not saved on the memory? Or I have to save the bitmap to a file, read it and next attach it?
helloimyourmind
  • 994
  • 4
  • 14
  • 30
0
votes
2 answers

Android Image taking a long time to get from URL

Currently i'm loading images from a url and it is taking way to long and i cannot work out why, sometimes taking longer than 60 seconds to get images that aren't really that big. My Code: Get image async task: public class GetImageAsyncTask extends…
Joe Maher
  • 5,354
  • 5
  • 28
  • 44
0
votes
3 answers

Android: Attempt to invoke virtual method a null object reference

I have some problem. Here in my code I am trying to redraw drawing drawn on board on screen rotation. but I am getting Null Object Reference exception In my code bitmaps is an Bitmap arraylist. Here's my saveInstanceState code @Override protected…
0
votes
1 answer

How to use BitMap in Android for following design?

I have just started to use Bitmap and want to try design something this button: I am using SpannableString for further process. How can I get this type of shape with rounded corner with Bitmap?
user5063816
0
votes
1 answer

Bitmap cannot be created from an image file

As part of my program, I need to show images belonging to a folder (JPG files). To accomplish that, I have this code: private ArrayList getData() { final ArrayList imageItems = new ArrayList<>(); try { …
jstuardo
  • 3,901
  • 14
  • 61
  • 136
0
votes
1 answer

Capturing View to Bitmap returns old image

I need to capture View to a Bitmap. That's how I tried to do that: private Bitmap getBitmapFromView1(View rootView) { Bitmap b = Bitmap.createBitmap(rootView.getWidth(), rootView.getHeight(), Bitmap.Config.ARGB_8888); Canvas…
darja
  • 4,985
  • 9
  • 33
  • 47
0
votes
2 answers

Image gallery album cover effect in android

I want to make effect like attached image in android Can any one help please?
Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175
0
votes
1 answer

Android: Android app crashing when trying to load saved Bitmap data to Canvas

First of all thanks in advance for the help. My app is basically a sketchbook with multiple canvas. Here after drawing on first canvas and when I click on Next button new canvas is loaded and previous canvas is saved into an Bitmap array. After…
Jishnu Mk
  • 143
  • 1
  • 3
  • 12
0
votes
3 answers

How do you calculate the size of a loaded image

I have a an image image.png in the drawable folder (not any of the other drawable-hdpi, etc. folders). This image's size is 50x50. But when I load it from my application like so: BitmapFactory.decodeResource(getResources(),…
Stralo
  • 474
  • 4
  • 16
0
votes
0 answers

Android: Recover image bitmap from representation as decoded string

I am makinga web service call to fetch a jpeg image, I store it as String in order to be the Value of some Json field (web service return Json...). The web service himself retrieve the image from URL, so in overall I have insdie my web…
michael
  • 3,835
  • 14
  • 53
  • 90
0
votes
1 answer

How to centerCrop an image Programatically by maintaining Aspect ratio like centerCrop do in XML?

How to centerCrop an image like the same method "centerCrop" do in xml android ? I don't want to crop the center of the image .I have tried the below code but ,it was cropping the center portion of the image,and it produce a square shaped image,I…
Jack
  • 1,825
  • 3
  • 26
  • 43