android-bitmap

How to set bitmap image in Glide on Android

心不动则不痛 提交于 2020-01-03 14:28:32
问题 I have a SqliteDatabase in my application. In this database, I save Sting and Blob(for save image) . This image is saved in application with byte[ ] . I convert this image to Bitmap with the help of following code: byte[] Recycler_imageByte; Bitmap Recycler_theImage; holder.Recycler_imageByte = data.get(position).getKey_image(); ByteArrayInputStream imageStream = new ByteArrayInputStream(holder.Recycler_imageByte); holder.Recycler_theImage = BitmapFactory.decodeStream(imageStream); I want to

How to add String on Bitmap Image in Android?

余生颓废 提交于 2019-12-31 04:13:27
问题 I want to add a string on bitmap image.I have a metod drawTextToBitmap ,this method working success place string on bitmap image.But my bitmap image is very small like pinmark image.This function set the string based on the bitmap height and width.I want to place the string exceed than the bitmap image.So Please help me to solve the problem. Following method i am using to get bitmap : public Bitmap drawTextToBitmap(Context gContext, int gResId, String gText) { Resources resources = gContext

Convert RGB to X and Y in a bitmap

三世轮回 提交于 2019-12-25 16:56:32
问题 I have a code which takes a bitmap and converts the X and Y coordinate to RGB: int pixel = bitmap.getPixel((int)x,(int) y); inRed = Color.red(pixel); inBlue = Color.blue(pixel); inGreen = Color.green(pixel); How do I convert a given RGB and get the X and Y coordinate within the bitmap? 回答1: To find the first pixel in a Bitmap with given Color: int color = // your color int x, y; // used for output boolean found = false; for (int ix = 0; ix < bitmap.getWidth(); ++ix) { for (int iy = 0; iy <

android crop image from gallery nullpointexception

こ雲淡風輕ζ 提交于 2019-12-25 16:53:50
问题 I'm working in Camera.i want to choose image from my gallery and crop selected photo and then show it in my imageview.i wrote some code but i have problem in cropping. this is a my error Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getScheme()' on a null object reference private void CropPictureFromGallery() { Intent pickImageIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

Sharing bitmap in memory without asking for read permissions using ACTION_SEND

感情迁移 提交于 2019-12-25 09:17:23
问题 I am trying to store a bitmap within the app's storage using file provider and then share it via ACTION_SHARE, I am trying to avoid the read external storage permissions while sharing the image (it is the screenshot of the current view of the app -> bitmap). Though I add the FLAG_GRANT_READ_URI_PERMISSION flag the receiver app always asks for the permissions, if I grant the permissions then the image is accessible by the receiver app else the receiver app does not show the image. Can someone

Memory heavy oval gradient

那年仲夏 提交于 2019-12-25 08:49:26
问题 As you may know it is not possible to draw an oval radial gradient using regular Android API. This is what I want to achieve: So I implemented this solution: draw a regular radial gradient on a square bitmap and then this bitmap will get stretched by the view itself (idea found here: https://stackoverflow.com/a/3543899/649910) This works great however this solution takes a lot of memory, because of BitmapDrawable usage (see implementation details below). Any ideas on how to avoid usage of

skia decoder->decode returned false when download image and display in imageview

别来无恙 提交于 2019-12-25 07:46:29
问题 i have a php page which return image from php page in json format $result = mysql_query("SELECT image FROM image_table WHERE email_id = '$email'"); if (!empty($result)) { if (mysql_num_rows($result) > 0) { $result = mysql_fetch_array($result); $user = array(); $user["image"] = base64_encode($result["image"]); $response["success"] = 1; $response["image_table"] = array(); array_push($response["image_table"], $user); echo json_encode($response); } else { $response["success"] = 0; $response[

Not able to get the bitmap from View

被刻印的时光 ゝ 提交于 2019-12-25 04:42:12
问题 In my application i want the image which is inside the linear layout.So for that i have used view.setDrawingCacheEnabled(true); // this is coming as undefined view.buildDrawingCache(); // this is coming as undefined Bitmap cache = view.getDrawingCache(); //here am getting null But whenever i debug the code i am getting null at " view.getDrawingCache()". Code public static void saveLayout(View view) { view.setDrawingCacheEnabled(true); view.buildDrawingCache(); Bitmap cache = view

Android TransactionTooLargeException with NotificationManager

旧时模样 提交于 2019-12-24 22:16:40
问题 I am getting TransactionTooLargeException exception when sending a notification with a custom layout. java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 588636 bytes at android.app.NotificationManager.notifyAsUser(NotificationManager.java:380) at android.app.NotificationManager.notify(NotificationManager.java:286) at android.app.NotificationManager.notify(NotificationManager.java:270) It's probably because of the bitmaps in the layout, but it's not happening

data byte array size different for onPictureTaken and onPreviewFrame

限于喜欢 提交于 2019-12-24 15:03:31
问题 Why is the data byte array size different for onPictureTaken(byte[] data, Camera camera) and onPreviewFrame(byte[] data, Camera camera). The former has the original image and hence gives me a clean image and the latter gives me a pixelated image. I am not using onPictureTaken because it does not get triggered sometimes. If my picture size is 1600 x 1400 and screen size is 800 x 480 onPictureTaken gives me 1600 x 1400 and onPreviewFrame gives me 800 x 480 This is my code: mCamera