i have an app that get picture from gallery and display into ImageView.
i want the image to stay. when a user select image from gallery or camera i want the image to set as profile.the problem i have is when image selected and display, if i reopen the app the image is gone it does not say.i know i could you url but i dont want like that. whether SharedPreference , Bitmap catch or string64 i dont know. i'm feeling dump now i couldn't solve and couldn't find any example. i searched a lot but i couldn't find.
Thank you!!!!
I understand your requirement as to persist the profile image. Basically you can get the image from gallery and store it in your app storage. So next time, you open the app you can get the image from storage.
Related
I am trying to integrate my project with PESDK. I need to get image that is currently in the editor. I found that PESDK has R.id.editorImageView. This is object of EditorPreview class which isn't an extension of ImageView. So I didn't understand how to extract the image. Because of word Preview I suppose that PESDK do not apply immediately all changes to the image and in the end after pressing default AcceptButton of PESDK it runs final calculations and saves this image.
Is there any way that I can emulate this action? I just need to get Bitmap in the memory without saving it.
If there is no such way then I think the one possible solution is to call onClick of default AcceptButton and notify my code that it was pressed myButton, not AcceptButton. Then read saved image, process it and then delete file. I'm quite new in Android and if you know how to do this notification (that it was myButton pressed) then please share your knowledge.
Thank you for any help or advice!
I have used Picasso lib to load images from server and it works fine for me but when I want to select another image from Gallery to load it into the same image view nothing happens.
Here is my code
Picasso.with(EditProfileActivity.this)
.load(User.getInstance().getProfilePicPath())
.placeholder(R.drawable.defaultpp)
.error(R.drawable.defaultpp)
.into(imageView);
By the way when I comment the above line, I can select an image and show it into the image view, so can anyone give the reason of what happened ?
If you want to load images from gallery, you can pass file URI into Picasso
Picasso.with(getActivity()).load(fileUri).into(imageView);
You also have to make sure that you have enough permissions to fetch the given image.
This is an issue with the picasso lib, and has been answered by the creator itself, though solved in the latest version (but is still in alpha), a work around for picasso with Uri is this:
Picasso.with(this).load("file://" + User.getInstance().getProfilePicPath()).placeholder(R.drawable.placeholder)
.config(Bitmap.Config.RGB_565).into(imageview);
Make sure you dont forget the file:// prefix
Ref: the issue tracker for Picasso here
Because of when you select image your activity is sended back and imageviews route is lost. So yo have to define it again when it returns to your activity. add onResume or add onRestoreInstanceState then define imageview again ex: imageview findview... etc. It is the problem.
I am developing a Android application that display's images loaded from the sdcard.
I use the mediastore to populate a recyclerview.
If the user would click a image in the recyclerview i would like to open a activity that shows the image in full size.
When the clicked item is a huge image it takes 4/5 seconds to load.
I noticed some applications can somehow load them instantly(quickpic, google photos).
How do they do this and or what is the best practise?
I am using Glide for the async loading and caching.
I tried the glide function that loads a thumbnail first and loads the full image in the background.
I tried resizing and subsampling the image.
And thats about all the techniques i could find.
Some code i tried:
Glide.with(this)
.load(getUri().toString())
.asBitmap() .diskCacheStrategy(DiskCacheStrategy.RESULT)
.priority(Priority.IMMEDIATE)
.dontAnimate()
.thumbail(0.1f)
.override(height,width)
.info(imageView
)
I have created a quiz app and once the user has finished the quiz an activity opens which shows a certificate with the user's achievements. I want the device to screen shot the certificate so that the user can view the screenshot in the gallery at a later date. What code should I put into my OnClickListener.
Thanks in advance.
It sounds like you don't need to actually take a screenshot, you likely just want to save your View to a bitmap. Take a look at this answer: Converting a view to Bitmap without displaying it in Android?
If you want to print the current content of the browser window. Use: window.print();
I would like to create a gridview of images, in which, these images will be downloaded based on a web service response.
The thumbnails of images will be displayed in a gridview, similar to how iPhone displays photos.
User can tap on the image and the corresponding full-res image will be shown, sized to fit within the android phone. Upon tapping on the full-res image, it will minimize and return to the gridview.
So far, following the guide here, I had manage to create the gridview of images, but I would like to have it expand to the original size upon tapping and tapping again, return to the gridview.
See the Gallery, maybe all you need to do is change the OnItemClick behaviour.
http://developer.android.com/resources/tutorials/views/hello-gallery.html