imageview

How to get image from sdcard in android?

丶灬走出姿态 提交于 2019-12-21 05:06:51
问题 i want create simple app in which i want get the image from sdcard but can`t success. my code is below File myFile = new File("/sdcard/photo.jpg"); ImageView jpgView = (ImageView)findViewById(R.id.imageView); BitmapDrawable d = new BitmapDrawable(getResources(), myFile.getAbsolutePath()); jpgView.setImageDrawable(d); but can`t get the image. 回答1: Use below code instead of your code. File f = new File("/mnt/sdcard/photo.jpg"); ImageView mImgView1 = (ImageView)findViewById(R.id.imageView);

Android set bitmap to Imageview

时光总嘲笑我的痴心妄想 提交于 2019-12-20 16:18:23
问题 Hi i have a string in Base64 format. I want to convert it ot a bitmap and then display it to an ImageView. This is the code: ImageView user_image; Person person_object; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.user_profile_screen); // ImageViews user_image = (ImageView) findViewById(R.id.userImageProfile); Bundle data = getIntent().getExtras(); person_object = data.getParcelable("person_object"); // getPhoto()

Android set bitmap to Imageview

这一生的挚爱 提交于 2019-12-20 16:18:08
问题 Hi i have a string in Base64 format. I want to convert it ot a bitmap and then display it to an ImageView. This is the code: ImageView user_image; Person person_object; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.user_profile_screen); // ImageViews user_image = (ImageView) findViewById(R.id.userImageProfile); Bundle data = getIntent().getExtras(); person_object = data.getParcelable("person_object"); // getPhoto()

Android - Best way to overlay a play button on an image/thumbnail

强颜欢笑 提交于 2019-12-20 14:12:12
问题 I have an android application which can playback audio/video and show pictures. For videos I want to overlay a play button on top of the preview image and also in list views.. Right now how I'm doing it is with an ImageView in xml, and then the drawable is a layer layer-list which I define programmatically because one of the images is dynamic, the play button is static of course. I want to align the play button 10px from the bottom, and centered horizontally. My ImageView is defined like this

Android apply colorMatrix colorFilter on part of imageView with a mask

倖福魔咒の 提交于 2019-12-20 10:47:16
问题 I want to change the brightness on certain part of an image. I know how to use ColorMatrix to change the brightness(or hue) of an image. But it will be applied to the whole image. I have a mask file (black and white image). I want to apply the brightness change only on the the white part of that mask.How to do this in Android? Below is a mask image and the result I want to get. 回答1: for given bitmap and mask: first create a temporary bitmap: bitmap = BitmapFactory.decodeResource(ctx

Copy Bitmap contents of one ImageView to anoher

元气小坏坏 提交于 2019-12-20 10:11:45
问题 This has me baffled. I need to copy the Bitmap from one ImageView into another. I do not want to simply copy one ImageView to another because I need to do some changes to the bitmap on its way over. Here is some code that doesn't work. ImageView ivSrc = (ImageView) findViewById(R.id.photo); ivSrc.setDrawingCacheEnabled(true); Bitmap bmSrc1 = ivSrc.getDrawingCache(); // will cause nullPointerException Bitmap bmSrc2 = Bitmap.createBitmap(ivSrc.getDrawingCache());//bmSrc2 will be null View vSrc

Android Bitmap Memory Issue - Error: Out of memory on a 8294416-byte allocation

非 Y 不嫁゛ 提交于 2019-12-20 09:59:40
问题 I am currently developing an app that goes through a story. The story contains "scenes" which contain multiple JPEG and PNG files that are displayed via ImageViews. I create the ImageView and add at it to the layout via the following function: private ImageView newImage(Show show) { ImageView iv = new ImageView(this); String filePath = comin.generateFilePath(show); Log.i(TAG, "newImage, filePath = " + filePath + " id = " + show.id); WeakReference<Bitmap> bmp = new WeakReference<Bitmap>

Android Volley - how to animate image loading?

会有一股神秘感。 提交于 2019-12-20 09:38:22
问题 any idea how to play a fade in animation when image loads? Now it just blinks into place. I am using NetworkImageView from the Volley toolkit. Also, is there a way to set loading and error bitmaps on the network image view without using the ImageLoader.get( .. ) ? Thanks! //EDIT : Okay, thanks to you all, but if we want to be perfectionists, we should only animate if loading from disk cache, overriding setImageBitmap would case animation to go off even if pulled from memcache what you want to

Android ImageView setImageResource in code

房东的猫 提交于 2019-12-20 08:49:16
问题 I have an imageView that i want to display a little icon of the country that you are currently in. I can get the country code, but problem is i can't dynamically change the imageView resource. My image files are all lowercase (Example: country code=US, image file=us) My code (countryCode is the current countryCode in uppercase letters): String lowerCountryCode = countryCode.toLowerCase(); String resource = "R.drawable." + lowerCountryCode; img.setImageResource(resource); Now, of course this

android imageview onClick animation

我只是一个虾纸丫 提交于 2019-12-20 08:26:51
问题 I guess this is kind of an odd question but I have tried setting onClicklistener on an ImageView and it has worked. But the problem is that the user cannot sense the click. I mean if some of u have worked on other mobile environs(like Apple iPhone) then when we click on an Image in other environs then it gives an effect on the image so that the user can understand that the image has been clicked. I have tried setting alpha using setalpha method but it doesn't work. Though the same thing is