android-image

How to clear an ImageView in Android?

泄露秘密 提交于 2019-11-26 15:43:56
I am reusing ImageView s for my displays, but at some point I don't have values to put it. So how to clear an ImageView in Android? I've tried: mPhotoView.invalidate(); mPhotoView.setImageBitmap(null); None of them have cleared the view, it still shows previous image. Mario Lenci I used to do it with the dennis.sheppard solution: viewToUse.setImageResource(0); it works but it is not documented so it isn't really clear if it effects something else in the view (you can check the ImageView code if you like, i didn't). I think the best solution is: viewToUse.setImageResource(android.R.color

Android Text over image

狂风中的少年 提交于 2019-11-26 15:13:34
问题 I have an imageView with an image, over that image I want to place a text. How can I achieve that? 回答1: That is how I did it and it worked exactly as you asked for inside a RelativeLayout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/myImageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="

Set Imageview to show image in sdcard?

早过忘川 提交于 2019-11-26 13:49:53
问题 I have a image stored in SD card of my phone. I want to show it in a image view. I know the location of the file. On the oncreate of the activity is there a simple way to say something like ImageView img = (ImageView) findViewById(R.id.imageView1); String path = Environment.getExternalStorageDirectory().toString() "Images/image.jpg"; img.setsrc = path ; Please let me know if there is any way to do this. Thank you. 回答1: Bitmap bmp = BitmapFactory.decodeFile(pathName); ImageView img; img

Open an image using URI in Android&#39;s default gallery image viewer

僤鯓⒐⒋嵵緔 提交于 2019-11-26 12:09:36
I have extracted image uri, now I would like to open image with Android's default image viewer. Or even better, user could choose what program to use to open the image. Something like File Explorers offer you if you try to open a file. Accepted answer was not working for me, What had worked: Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + "/sdcard/test.jpg"), "image/*"); startActivity(intent); Ask myself, answer myself also: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/external/images/media/16"))); /**

Reading an image file into bitmap from sdcard, why am I getting a NullPointerException?

て烟熏妆下的殇ゞ 提交于 2019-11-26 12:07:21
How can I read an image file into bitmap from sdcard? _path = Environment.getExternalStorageDirectory().getAbsolutePath(); System.out.println("pathhhhhhhhhhhhhhhhhhhh1111111112222222 " + _path); _path= _path + "/" + "flower2.jpg"; System.out.println("pathhhhhhhhhhhhhhhhhhhh111111111 " + _path); Bitmap bitmap = BitmapFactory.decodeFile(_path, options ); I am getting a NullPointerException for bitmap. It means that the bitmap is null. But I have an image ".jpg" file stored in sdcard as "flower2.jpg". What's the problem? The MediaStore API is probably throwing away the alpha channel (i.e.

Get Meta Data of Image - Android

北城以北 提交于 2019-11-26 11:31:56
问题 http://www.isco.com/webproductimages/appBnr/bnr1.jpg I\'ve used a website to see the metadata of a image. In this website, it shows all info of image. I want to know how to get the \"Title\" tag of above image in android. I found here the similiar question for iOS only: How to get image metadata in ios However I don\'t know how to get \"Meta data\" of image on android. ExifInterface only gives some informations. But I\'m unable to get \"Title\" tag with it. Can you provide any code snippet

Out of Memory error with Bitmap

坚强是说给别人听的谎言 提交于 2019-11-26 11:24:02
During runtime, I am trying to put an image in the surface view. When I tried using the image from the Drawable folder I got Out of memory error. After a quick search in the stackoverflow, I found that there will be some relief if we access the image from the asset folder. But still I get the Out of memory error during runtime. I have analyzed and found that scaling will help in resolving this kind of memory related issues. The thing is that I have the image size of 1280 x 720 and the device size also the same. Hence I feel like the scaling will not have any effect. As we have experts in this

“Bitmap too large to be uploaded into a texture”

这一生的挚爱 提交于 2019-11-26 09:58:31
I'm loading a bitmap into an ImageView, and seeing this error. I gather this limit relates to a size limit for OpenGL hardware textures (2048x2048). The image I need to load is a pinch-zoom image of about 4,000 pixels high. I've tried turning off hardware acceleration in the manifest, but no joy. <application android:hardwareAccelerated="false" .... > Is it possible to load an image larger than 2048 pixels into an ImageView? jptsetung All rendering is based on OpenGL, so no you can't go over this limit ( GL_MAX_TEXTURE_SIZE depends on the device, but the minimum is 2048x2048, so any image

Android make animated video from list of images

十年热恋 提交于 2019-11-26 09:08:44
问题 I want to make animated video from list of images by applying transition animation between two images. I found many similar questions on SO like, Android Screen capturing or make video from images Android- How to make video using set of images from sd card? All similar SO questions suggest to used animation for that, but how can we store that animated images to video file? Is there any Android library support this facility to make video of images? 回答1: Android do not support for AWT's

Access pictures from Pictures app in my android app

三世轮回 提交于 2019-11-26 08:47:31
问题 Just like the iPhone has a UIImagePickerController to let the user access pictures stored on the device, do we have a similar control in the Android SDK? Thanks. 回答1: You can use startActivityForResult , passing in an Intent that describes an action you want completed and and data source to perform the action on. Luckily for you, Android includes an Action for picking things: Intent.ACTION__PICK and a data source containing pictures: android.provider.MediaStore.Images.Media.INTERNAL_CONTENT