In my app there is an image that the user imported using the gallery
then doen the imageview where the picture has been inserted
there is two seekbars
the first seekbar controls the picture brightness
and the other controls the picture hue
when I use them they are working, but the problem is they don't save
like ..
I imported the picture then made its brightness its working great
but when I set the picture hue the brightness that i made disappears
and the hue starts
isn't there
iv.save;
or anything like that?
note*
final ImageView iv = (ImageView) findViewById(R.id.picture);
Yes there is.
final ImageView iv = (ImageView) findViewById(R.id.picture);
iv.setDrawingCacheEnabled(true);
Bitmap bmp=iv.getDrawingCache();
Now you can save this Bitmap to your sdcard in jpg or png format.
Related
I am wondering when the same image resource is set to the imageView again, will the imageView redo all the processes? (The size of imageView and size of image does not change.)
Like the following scenario
imageview.setImageBitmap(b);
imageview.setImageBitmap(b);
This situation I have met in Android and still can't find any solution.
I have an ImageView display by these code:
BitmapDrawable value = ...;
imageView1.setImageDrawable(value);
Then I use imageView2 to display the same image in Drawable:
imageView2.setImageDrawable(value);
And ops,... the image in imageView1 auto scale and become bigger than the older. (imageView2 is bigger than imageView1).
Is there anyone saw this situation before?
Drawables are immutable, so the one bitmap is getting scaled and then shown by both ImageViews.
To get a different (unshared) version for the second one, try:
imageView2.setImageDrawable(value.mutate());
I am trying to build an Android game in which a user will have choice to select a player from 4 available players. These Players are available as Image Buttons. I want that when a user clicks a image Button, this image will be assigned to a Bitmap variable 'PLAYER' in the Main Activity.java .
Please help me out with codes to extract the Image from clicked button and assign it to the variable PLAYER.
Any help would be grateful. Thanks!!
yor can get bitmap form Imageview by using
Drawable dra = imageview.getDrawable();
BitmapDrawable bmp = (BitmapDrawable) dra;
Bitmap b = bmp.getBitmap();
and set this bitmap to your player object
method of image view.
I have a imageview and a camera button in Activity A. By clicking on the camera button will go to my custom camera activity. After taking a picture and storing it into a folder, how can I reflect this newly picture taken in the imageview after finishing the camera activity? Any help will be appreciated ?
A(main) > B(camera activity) > A(main) Imageview is updated with new picture taken.
Thanks.
According to my understanding of your question, you want to know how to set an image, residing on sdCard, to an ImageView. Well, let's say you can get the image path from your camera activity and then you can do something like below:
String imageInSD = "/sdcard/img.PNG";
Bitmap bitmap = BitmapFactory.decodeFile(imageInSD);
ImageView myImageView = (ImageView)findViewById(R.id.imageview);
myImageView.setImageBitmap(bitmap);
I hope it'll serve the purpose, if this is what you want.
I want to be able to set the background of an image button in an xml file to be the picture the user took on the phone.
I have the picture set as cameraBitmap.
cameraBitmap = (Bitmap) intent.getExtras().get("data");
and I want to pass that picture to be the bakground of the imagebutton. The problem is, the method: setBackgroundDrawable() only can pass in a drawable. How do I go about changing that Bitmap to a drawable picture and making it the background?
I currently have:
private ImageButton theImageButton;
theImageButton.setBackgroundDrawable(cameraBitmap);
If you are using ImageButton why can't you use this
theImageButton.setImageBitmap(cameraBitmap)