Questions tagged [bitmapdrawable]

42 questions
9
votes
3 answers

What is "Resources" in BitmapDrawable constructor really?

As the parameterless BitmapDrawableconstructor is deprecated, we have to give resource id to the constructor. BitmapDrawable bitmapDrawable = new BitmapDrawable(res, bmap); Where res is generally getResources(). Why does the constructor need it and…
9
votes
1 answer

Android - new BitmapDrawable deprecated; alternative Bitmap.createBitmap has to have w/h > 0

I've used a PopupWindow. With this PopupWindow I set the BackgroundDrawable to an empty BitmapDrawable. When I use the following code it gives a deprecated warning: myPopupWindow.setBackgroundDrawable(new BitmapDrawable()); So I changed it…
Kevin Cruijssen
  • 9,153
  • 9
  • 61
  • 135
4
votes
2 answers

Custom PopupWindow with BitmapDrawable deprecated method

In my App using custom PopupWindow where am using popup.setBackgroundDrawable(new BitmapDrawable()); method. Now it is deprecated here and without this method i can't be able to give background for my popup. I read from article that its…
3
votes
2 answers

Android - png resource converted to a ColorDrawable on android < 4.0

According to documentation here, A png resource should be converted to a BitmapDrawable. However I'm observing a strange behavior wherein a png file which has only black pixels in it is resulting in a crash because of ClassCastException (wrapped in…
2
votes
1 answer

Casting from RoundedBitmapDrawable to BitmapDrawable

Everything worked well before starting using RoundedBitmapDrawable to round Bitmap's corners. After starting using RoundedBitmapDrawable, I'm getting: java.lang.ClassCastException: android.support.v4.graphics.drawable.RoundedBitmapDrawable21…
2
votes
1 answer

Convert BitmapDrawable to Bitmap

In my project a bitmap gets filled with text and another bitmap, the method to add the text to the bitmap returns a BitmapDrawable. I want to save this BitmapDrawable as a pdf file, so I can email the original bitmap, with text and other image(s)…
TomCB
  • 3,983
  • 9
  • 40
  • 66
2
votes
1 answer

Issue when recycling bitmap obtained from 'BitmapDrawable'

I'm loading a bitmap to use as a texture in my OpenGLES 2.0 app If I load and use the bitmap via Bitmapfactory then all is OK. Like so: Load public void loadBitmaps{ backgrounds= BitmapFactory.decodeResource(view.getResources(),…
Zippy
  • 3,826
  • 5
  • 43
  • 96
2
votes
2 answers

Android: how to create a BitmapDrawable from a file in the file system?

So I'm trying to restore an image from a file in my app's private files directory. InputStream inputStream; BitMapDrawable result; try { inputStream = new FileInputStream(file.getAbsolutePath()); result =…
spacitron
  • 2,095
  • 7
  • 30
  • 39
1
vote
1 answer

layer-list drawable gets automatically converted to BitmapDrawable

I have created a layer list drawable of 3 bitmap drawables in xml. When I try to retrieve that drawable in java code, I receive a BitmapDrawable object, not a LayerDrawable object. Here is my layer-list drawable XML code:
1
vote
0 answers

Preserve Bitmap dimensions when saving to file from ImageView

I am trying to save the drawable inside of a ImageView to a file. I use Glide to load an image into the ImageView like this: Glide.with(context) //items[position] is a string that represents a url .load(items[position]) …
Foobar
  • 7,458
  • 16
  • 81
  • 161
1
vote
1 answer

LRUCache BitmapDrawable

I'm using an LruCache to cache a lot of small BitmapDrawables used throughout my app. The problem is that the sizes differ for the different places I use the images. I set the bounds when I retrieve the drawable from the cache before setting it to…
Pierre
  • 8,397
  • 4
  • 64
  • 80
1
vote
1 answer

Different drawable loading from app resources versus test resources

I am writing some UI tests for the app that I'm working on and I need to switch an image based on a push notification. To write the test without push notifications, I'm placing a png file in the androidTest res directory and then loading it with…
1
vote
1 answer

How to show Android SeekBar progressChanged value inside SeekBar thumb?

I want to show the value of the current progress point in the thumb of an Android SeekBar. This is what I have tried so far: SeekBar progBar = (SeekBar)FindViewById(Resource.Id.seekBar1); progBar.ProgressChanged += (object sender,…
1
vote
1 answer

Setting BitmapDrawable tileMode makes the app restart

While on most of the devices my app is working fine, on some devices (LG G3, Samsung Galaxy S6 so far) I have experienced a strange error, I can not really unfold: Setting tileMode (either via XML or programmatically) to anything…
1
vote
0 answers

how to set an smaallest image as windowBackground keeping aspect ratio

seeking experts attention.. I wanna set an image(which is smaller than device screen resulation) as background of my app .. I want it to fill the entire window but keeping the ascpect ratio of image... (if the image aspect ratio doesn't match with…
dhir
  • 187
  • 2
  • 15
1
2 3