android-image

copy images from assest to sd card on install android application

[亡魂溺海] 提交于 2019-12-11 17:50:50
问题 i have some images should be displayed in the Application, the Q. is how to copy the images i am putting in the assets folder in the code to a folder under the SC card of the user on install the application on the phone 回答1: Try with this, private void copyAssets() { AssetManager assetManager = getAssets(); String[] files = null; try { files = assetManager.list(""); } catch (IOException e) { Log.e("tag", e.getMessage()); } for(String filename : files) { InputStream in = null; OutputStream out

How to convert YUV to bitmap in landscape orientation?

徘徊边缘 提交于 2019-12-11 16:07:35
问题 First Method When I set javasetRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); or java setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); Camera2 is running fine and save image from imageavailablelistener. Second Method When I set java setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); or java setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); It will exit from the app and cannot save image Conversion Credit YUV Image to

store image to SD card

左心房为你撑大大i 提交于 2019-12-11 15:26:10
问题 i'm using cropping functionality in my android application and it works fine but i want to save cropped image to my SD Card . For that what steps needs to be followed? 回答1: If the Bitmap you cropped is called yourBitmap File sdcard = Environment.getExternalStorageDirectory(); File f = new File (sdcard, "filename.png"); FileOutputStream out = new FileOutputStream(f); yourBitmap.compress(Bitmap.CompressFormat.PNG, 90, out) 回答2: Try this : public void saveBitmap(Bitmap bmp) { String file_path =

Image Manipulation in Android app

微笑、不失礼 提交于 2019-12-11 15:04:54
问题 Can anyone help me on this one? I want to do image manipulation in my Android app like Brightness and Contrast. Any ideas ? 回答1: I previously posted an example of how to greyscale an image in android. This code could be used as a starting point for basic image manipulation. I also suggest you check out the ColorMatrix class 来源: https://stackoverflow.com/questions/5962032/image-manipulation-in-android-app

How to change the size of bitmaps when loaded from xml

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 12:29:58
问题 I know I can change the size of bitmaps loaded programmatically by using BitmapFactory.Options (i.e. forcing 32 via ARGB_8888 or 16 bit via RGB_565). Is there an equivalent when loading bitmaps via xml (such as when defining drawables and background images in a layout)? If there isn't a built-in switch available that configures this, is there a way to accomplish this other than stripping the graphics out of the xml and handling them manually? 回答1: You cannot do this from XML, you have to do

ImageDetailsActivity for a recycler view

邮差的信 提交于 2019-12-11 11:44:07
问题 in my android app, I am listing the images' previews with network image view. I want that if user press the previews it opens an activity with viewpager and show the original images of specific item of my recycler view. So, i have a two method in my mind. 1-) I will save two image for each of my images in my database. One of them will be preview image with small size and other one will be the original one. In my main newsfeed, app will load the preview images so download size will be smaller.

Issue accessing LRU disk cache accross activites

心已入冬 提交于 2019-12-11 11:14:59
问题 I am using Jake Wharton's LRU disk cache to store and retrive bitmaps that are displayed in a ListView. This works fine so long as I store and access bitmaps from within the same activity. However, if I try to access the cach from other activities within the app (i.e. so I don't have to downlaod the same image twice) I get a NullPointerException. Am I missing something here? This isn't a memory cache where the files could/would be removed. Shouldn't the disk cache be accessable from all the

How to set image view in android dialog box?

左心房为你撑大大i 提交于 2019-12-11 10:17:23
问题 I am trying to set image view in android dialog box. If I select an image from gallery it shown in dialog with selected image. I will tried to get image from galley and passed to path to alert dialog. 回答1: AlertDialog.Builder ImageDialog = new AlertDialog.Builder(MainActivity.this); ImageDialog.setTitle("Title"); ImageView showImage = new ImageView(MainActivity.this); ImageDialog.setView(showImage); ImageDialog.setNegativeButton("ok", new DialogInterface.OnClickListener() { public void

Is there any open source library is available in android for resizing the image?

我是研究僧i 提交于 2019-12-11 09:52:24
问题 I wish to know if any open source libraries are available for resizing the image in Android. Because in my application i used camera to capture the image. The image supported sizes are differed from device to device. So here i used the top most size of the device for example HTC Wildfire has 19 sizes i used 2592x 1952 (WxH). Here i want to re-size the actual image with the size of 250x250 without any loss or stretch in image. I Searched in Google and StackOverflow, i got this Solutions

Resize image after capture it from native camera but before save it to SD card

孤者浪人 提交于 2019-12-11 09:28:33
问题 I am opening a default Camera in my app on button click.when i click on button ,it works fine.But it capture the image of default size and I want to re-size the image before save it in SD card after capture it from default camera. 回答1: Use the following piece of code to set proper width and height for camera intent. Intent intent = new Intent( Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI ); intent.putExtra("outputX", width_of_output_image); intent.putExtra("outputY",