简体   繁体   中英

Android best practice for sharing images user experience

I have an Android application with which user can share posts with images on the server.

Images are taken by the camera - therefore I change the size to a smaller one and compress it. I also need the image to be in 2 formats - regular and thumbnail.

I guess better to create 2 versions on the device and U/L both?

I also do it in BG, so user will not be blocked for long time... Is it a good behaviour? Should I block the user for 10-20-30 seconds (depending on the network speed?)

What is the common use? Recommnedations?

No ... it would be a better experience if you just upload the large image, and have the server take care of thumbnail generation. That way, you can minimize the user's data usage, and also the time it takes to upload an image.

Also, definitely don't block the user ... do the upload in the background, and let the user continue using the app.

  • Sending your images using the multipart content type.

  • If you have an additional step where the user start typing additional information (like a title, description etc.) you can start uploading your image so that the user won't notice the delay (do it asynchronously). That's what Instagram does.

  • Speaking of the size of your Bitmap I think you should consider sending only one normal version of it and let the thumbnailing be done by the server. However you have to compress it (JPEG/PNG) and you can also scale it down by a factor of 2 otherwise you might experience memory errors.

  • On a side note (not really related to your question) be careful of how much memory is left for your app to use when displaying a large amount of Bitmap . Before Honeycomb, Bitmap were allocated on the native heap but accounted on the VM Heap (if I'm not wrong) so don't count simply on how much memory is left on the VM heap. This talk is worth a watch if you haven't yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM