android-bitmap

Huge byte[] in my app after HPROF

倖福魔咒の 提交于 2019-12-09 10:08:55
问题 From time to time, especially when implementing new functionalities in my app, I use DDMS + HPROF to analyze memory and heap use. As the App doesn't seem to have any performance-ANR issues and everything works smoothly, initially I didn't care about it - but now, as I see it's approximately always the same size, I'm wondering what the damn can it be. Everytime I run a HPROF, I check the Leak suspects tab. There's always an android.graphics.Bitmap instance that takes approximately 25% of all

programmatically create layer-list

随声附和 提交于 2019-12-08 20:31:22
问题 I am trying to programmatically create a layer-list with resized bitmaps as items. From what I have seen BitmapDrawable has been deprecated. The new constructor requires the following parameters - public BitmapDrawable (Resources res, Bitmap bitmap). I have started out with a very basic example below. BitmapDrawable background = new BitmapDrawable(); background.setBounds(10,10,10,10); Drawable[] layers = {background}; LayerDrawable splash_test = new LayerDrawable(layers); splash_test

Error : RuntimeException at DisplayListCanvas.throwIfCannotDraw

时光怂恿深爱的人放手 提交于 2019-12-08 14:59:58
问题 My application work very well on nougat emulator and many devices, but i found this exception in google play crash reporter, I don't know why it happened, The exception causes with nougat devices ++ only. the exception : java.lang.RuntimeException: at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:260) at android.graphics.Canvas.drawBitmap(Canvas.java:1420) at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545) at android.view.View

Draw Bitmap on another Bitmap with same width and height

你。 提交于 2019-12-08 12:00:26
问题 there I want to overlay an Bitmap onto my another Bitmap . You can say, I want to draw a Bitmap on another bitmap . Suppose that I have a Bitmap as: And I want to draw another bitmap onto this bitmap "KEEP CALM AND CHECK YOUR WORK"! This will be Bitmap 1 The Bitmap I want to place on this bitmap is like an effect overlay as: This will be Bitmap 2 The Problem I want to overlay Bitmap 2 onto Bitmap 1 say Bitmap 2 should come above Bitmap 1 . The Bitmap 2 Should get the width and height of the

How to use SHOW_OR_CREATE_CONTACT and also set a photo for the contact?

十年热恋 提交于 2019-12-08 06:52:47
问题 Background I know that there are various fields that can be set via this intent, such as address, phone numbers, name, etc... : final Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, Uri.parse("tel:" +PhoneNumberService.formatNumber(phoneNumber, PhoneNumberFormat.NATIONAL)); intent.putExtra(ContactsContract.Intents.Insert.NAME, name); intent.putExtra(ContactsContract.Intents.Insert.POSTAL_ISPRIMARY,address); intent.putExtra(ContactsContract.Intents.Insert.POSTAL

How to properly save frames from mp4 as png files using ExtractMpegFrames.java?

社会主义新天地 提交于 2019-12-08 05:26:28
问题 I am trying to get all frames from an mp4 file using the ExtractMpegFrames.java class found here http://bigflake.com/mediacodec/ExtractMpegFramesTest.java.txt What I currently do is create a temp file (File.createTempFile) in a directory that stores all the frames, create a FileOutputStream and do bm.compress(Bitmap.CompressFormat.PNG, 100, fOut) where fOut is the OutputStream with the file. Currently, the saved images look like this: https://imgur.com/a/XpsV2 Using the Camera2 Api, I record

How to use SHOW_OR_CREATE_CONTACT and also set a photo for the contact?

浪子不回头ぞ 提交于 2019-12-08 04:57:28
Background I know that there are various fields that can be set via this intent, such as address, phone numbers, name, etc... : final Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, Uri.parse("tel:" +PhoneNumberService.formatNumber(phoneNumber, PhoneNumberFormat.NATIONAL)); intent.putExtra(ContactsContract.Intents.Insert.NAME, name); intent.putExtra(ContactsContract.Intents.Insert.POSTAL_ISPRIMARY,address); intent.putExtra(ContactsContract.Intents.Insert.POSTAL,address); ... //other stuff, like on this post: http://stackoverflow.com/q/3456319/878126 The problem I'd

How to upscale an image without it becoming blurry

て烟熏妆下的殇ゞ 提交于 2019-12-08 02:49:48
问题 I have an ImageView that is 32x32. Its a sprite basically. But when I go to upscale the image, it blurs like this: But I want it to scale up in the application like this: This is the code I have tried, but it doesn't work. I want the final image to be put on an ImageView. @Override public View getView(int i, View view, ViewGroup viewGroup) { View v = view; ImageView picture; TextView name; if(v == null) { v = inflater.inflate(R.layout.gridview_item, viewGroup, false); v.setTag(R.id.picture, v

Android: Convert image object to bitmap does not work

a 夏天 提交于 2019-12-07 14:52:49
问题 I am trying to convert image object to bitmap, but it return null. image = reader.acquireLatestImage(); ByteBuffer buffer = image.getPlanes()[0].getBuffer(); byte[] bytes = new byte[buffer.capacity()]; Bitmap myBitmap = BitmapFactory.decodeByteArray(bytes,0,bytes.length,null); The image itself is jpeg image, I can save it to the disk fine, the reason I want to convert to bitmap is because I want to do final rotation before saving it to the disk. Digging in the Class BitmapFactory I see this

Skewed images in ImageView on Android 4.1.2

亡梦爱人 提交于 2019-12-07 10:29:23
问题 I have an app that displays an image in an ImageView , and am experiencing problem specifically for Android 4.1.2. It is confirmed to not work on three separate 4.1.2 devices, while working on 2.3.7, 4.2.1, 4.3 and 4.4.2. The error occurs for several different images, but not all. There seems to be something about some specific JPEG-files that doesn't work as intended. How it actually looks, and how it shows on Android 4.1.2: The above image (left) is one such problematic image file. A