bitmapfactory

Cannot show in ImageView a picture exported from the gallery

ぐ巨炮叔叔 提交于 2021-02-11 12:45:06
问题 I am creating an Android application that needs to store some multimedia files in the internal storage. The user can choose that multimedia files from the picker. Those files must be available even when the user removes them, so they are copied to the internal storage. Here's my code: final Bitmap bitm = MediaStore.Images.Media.getBitmap( this.getContentResolver(), uri ); final int bitmapRawLength = bitm.getAllocationByteCount(); final ByteBuffer byteBuffer = ByteBuffer.allocate(

ImageView RecyclerView Lazy Load

家住魔仙堡 提交于 2021-02-10 15:54:51
问题 I have a RecyclerViewAdapter which in onBindViewHolder, I make an AsyncTask call to download the image required from Google Cloud Storage. There are some items in the RecyclerViewAdapter which call for the same image. I tried to deal with this by only downloading the image if it doesn't already exist in the local file storage; otherwise if it does then it uses the image that has already been downloaded. Now what's happening is, if there are multiple items from the RecyclerView calling for the

Base64 decode for image/jpeg;base64 in android

大兔子大兔子 提交于 2020-11-26 08:49:54
问题 I am trying to decode base64 encoded string into bitmap in android. The encoded string will start with "image/jpeg;base64," I use the following method: public static Bitmap decodeBase64(String input) { byte[] decodedByte = Base64.decode(input, Base64.DEFAULT); // also tried using Base64.URL_SAFE , Base64.NO_PADDING return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length); } Assume that I am calling the above method as ImageView get_img=(ImageView)fundViewByID(R.id.getImg); get

Base64 decode for image/jpeg;base64 in android

纵然是瞬间 提交于 2020-11-26 08:49:48
问题 I am trying to decode base64 encoded string into bitmap in android. The encoded string will start with "image/jpeg;base64," I use the following method: public static Bitmap decodeBase64(String input) { byte[] decodedByte = Base64.decode(input, Base64.DEFAULT); // also tried using Base64.URL_SAFE , Base64.NO_PADDING return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length); } Assume that I am calling the above method as ImageView get_img=(ImageView)fundViewByID(R.id.getImg); get

Base64 decode for image/jpeg;base64 in android

旧街凉风 提交于 2020-11-26 08:49:30
问题 I am trying to decode base64 encoded string into bitmap in android. The encoded string will start with "image/jpeg;base64," I use the following method: public static Bitmap decodeBase64(String input) { byte[] decodedByte = Base64.decode(input, Base64.DEFAULT); // also tried using Base64.URL_SAFE , Base64.NO_PADDING return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length); } Assume that I am calling the above method as ImageView get_img=(ImageView)fundViewByID(R.id.getImg); get

Base64 decode for image/jpeg;base64 in android

梦想与她 提交于 2020-11-26 08:49:13
问题 I am trying to decode base64 encoded string into bitmap in android. The encoded string will start with "image/jpeg;base64," I use the following method: public static Bitmap decodeBase64(String input) { byte[] decodedByte = Base64.decode(input, Base64.DEFAULT); // also tried using Base64.URL_SAFE , Base64.NO_PADDING return BitmapFactory.decodeByteArray(decodedByte, 0, decodedByte.length); } Assume that I am calling the above method as ImageView get_img=(ImageView)fundViewByID(R.id.getImg); get

BitmapFactory.decodeFile() returns null

萝らか妹 提交于 2020-06-10 06:47:27
问题 I am creating an Android app in which you copy an image from location x to location y . After the copying is complete I would like to see the picture in a ImageView . I know the images location, but no matter what I try I can't create a bitmap object of it. The line which are causing my problems is this: BitmapFactory.decodeFile(dir+s); dir = getCacheDir().getAbsolutePath()+"/images/"; s = file name (eg. 1275123123.jpg) If I create a File object with the same path, and call f.isFile() , it

BitmapFactory.decodeFile() returns null

▼魔方 西西 提交于 2020-06-10 06:46:50
问题 I am creating an Android app in which you copy an image from location x to location y . After the copying is complete I would like to see the picture in a ImageView . I know the images location, but no matter what I try I can't create a bitmap object of it. The line which are causing my problems is this: BitmapFactory.decodeFile(dir+s); dir = getCacheDir().getAbsolutePath()+"/images/"; s = file name (eg. 1275123123.jpg) If I create a File object with the same path, and call f.isFile() , it

Cannot load image from a Url using BitmapFactory.decodeStream()

為{幸葍}努か 提交于 2020-01-23 13:36:06
问题 I am trying to download an image from a URL to display as an ImageView. The download is done in the background using AsyncTask. However, the call to the decodeStream of the BitmapFactory always returns a null object. I verified that the Url provided for the connection is right, but it seems that BitmapFactory cannot read the image from the InputStream returned by the HTTP connection. Here is the code below: @Override protected Bitmap doInBackground(String... uri) { Bitmap bm = null;

problems with big drawable jpg image

冷暖自知 提交于 2020-01-16 19:45:07
问题 during a couple of days i've been looking here and on the Internet in many post for a solution on an issue im having loading or moving a large jpg image (located as a drawable reource by now) and I think it's time to ask myself altought there are many questions and solutions very related. I'm developing a 3D terrain simulation with OpenGL and the problem is that I'm using as terrain texture a quite large jpg image ( 2048x2048 = 1,94 MB ). Let's look at some workarround I Did: 1st: Bitmap