android-gallery

How to take screenshot of a layout in android

倖福魔咒の 提交于 2019-12-01 20:41:18
I want to save my frame layout into gallery by taking the screen shot of the layout. This code works on a project(Name: Trial), but when I tried the same code on othe project(Name: Fg), It did not work. The photo is not being saved in the Gallery. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_background); } public Bitmap click(View view) { FrameLayout memecontentView =(FrameLayout) findViewById(R.id.my); View view1 = memecontentView; Bitmap b = Bitmap.createBitmap(view1.getWidth(), view1.getHeight(), Bitmap

Save image from ImageView to device gallery

两盒软妹~` 提交于 2019-12-01 18:51:38
I'm trying to save an image from ImageView to devices gallery. I tried this code Code Edit: URL url = new URL(getIntent().getStringExtra("imageURL")); File f = new File(url.getPath()); addImageToGallery(f.getPath(), this); public static void addImageToGallery(final String filePath, final Context context) { ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis()); values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); values.put(MediaStore.MediaColumns.DATA, filePath); context.getContentResolver().insert(MediaStore.Images.Media

How can I notify the gallery of a new image in android?

我怕爱的太早我们不能终老 提交于 2019-12-01 13:17:13
I have an android app that allows you to open an image on your phone using an intent to the Gallery. You make modifications to that image and the app saves it with a new name in the same folder the original was in. Since the gallery can't constantly be looking for new images is there any way to notify the gallery of a new image from my android app so it shows up next time the user opens the gallery? use the MediaScannerConnection - MediaScannerConnection.scanFile(context, new String[] { imagePath }, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void

Android Gallery fullscreen

岁酱吖の 提交于 2019-12-01 05:17:56
How do I implement a fullscreen gallery? i.e. image stretches to fill all the screen? To make it fullscreen: <activity android:name="YourActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> To make the images fill the screen you should do it on your adapter, creating a View with MATCH_PARENT x MATCH_PARENT and in your ImageView you created on getView you should make it fill all the space: yourImageView.setScaleType(ImageView.ScaleType.FIT_XY); Use this in Activity Manifest.xml give property like this android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" Thanks. 来源:

Permission denied : opening provider com.google.android.apps.photos.contentprovider.MediaContentProvider that is not exported from uid

纵然是瞬间 提交于 2019-12-01 05:10:17
My app is crashing only in android >= 6.0 (marshmallow) when I try to access a photo URI stored previously in SharedPreferences. Though the image is retrieved for the first time without any error. I am using targetSdkVersion 22 so that I don't need to handle run-time permissions in API >=23. Permissions in my Manifest file <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.READ_SMS" /> <uses

Permission denied : opening provider com.google.android.apps.photos.contentprovider.MediaContentProvider that is not exported from uid

℡╲_俬逩灬. 提交于 2019-12-01 01:56:05
问题 My app is crashing only in android >= 6.0 (marshmallow) when I try to access a photo URI stored previously in SharedPreferences. Though the image is retrieved for the first time without any error. I am using targetSdkVersion 22 so that I don't need to handle run-time permissions in API >=23. Permissions in my Manifest file <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name=

Take image from gallery and convert to base64 issue

对着背影说爱祢 提交于 2019-12-01 01:55:36
sorry for asking silly question.but it solved yet my me.please help i had tried all codes on stackoverflow and follow other tutorial but it wont help at all.i am taking image from galary and convert to base64 it works perfectly fine when taking image on camera but why it dont work on galary i dont know please help me.;( This is the code to select the image private void selectImage() { final CharSequence[] items = { "Take Photo", "Choose from Library", "Cancel" }; AlertDialog.Builder builder = new AlertDialog.Builder(TestFragment.this); builder.setTitle("Add Photo!"); builder.setItems(items,

Picture taken from camera or gallery when using in imageview its orientation getting changed, and sometimes vertically stretched in Android

我只是一个虾纸丫 提交于 2019-11-30 20:08:59
In my application I have to capture image from camera or import from gallery, show it in imageview in activity. Everything is fine, I am getting image from both and able to set it on imageview without any exception. But sometimes image is not getting scaled properly and gets vertically stretched or with orientation changed. Please help me out. Here is my code to decode image referred from official android documentation: public static Bitmap decodeSampledBitmapFromResource(File photoFile, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to check dimensions final

Showing images of gallery in my application

天大地大妈咪最大 提交于 2019-11-30 07:52:42
问题 I want to retrieve all the images from gallery from its database and want to display in my application in gridview. please tell how to do it.. 回答1: import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface;

Android : Why Intent.EXTRA_LOCAL_ONLY shows Google Photos

旧城冷巷雨未停 提交于 2019-11-30 07:41:48
What I'm trying to do in my application is to let the user choose a picture from his phone's gallery(Don't want to get gallery images only but also allowing a user to choose their app of choice). The code I'm using is as follows: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); startActivityForResult(Intent.createChooser(intent, "Select Picture"), 1); As per Intent.EXTRA_LOCAL_ONLY doesnt work EXTRA_LOCAL_ONLY only tells the receiving app that it should return only data that is present. After