android-contentresolver

How to share image to social media with bitmap?

依然范特西╮ 提交于 2019-12-06 09:07:34
I need to share an image from my RecyclerAdapter because the image does not initially exist, i.e. is loaded within the Activity making use of the adapter. How can I share the bitmap to social media? Every time I click share in my app it says "No apps can perform this action". feedItemView.setFeedSocialShareClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Share to Social Media ImageView imageView = (ImageView) feedItemView.findViewById(R.id.image); Drawable mDrawable = imageView.getDrawable(); Bitmap mBitmap = ((BitmapDrawable)mDrawable).getBitmap(); String

how to view image through image id in android

我只是一个虾纸丫 提交于 2019-12-06 08:09:43
I've got the image id in the MediaStore. How can I view the image in the gallery with the id? I currently use the following code: ContentResolver cr = context.getContentResolver(); String columns[] = new String[]{ Media._ID, Media.DATA }; Cursor cursor = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, Media._ID+"=?", new String[]{id+""}, null); if(cursor.moveToNext()) { String imagePath = cursor.getString(cursor.getColumnIndex(Media.DATA)); Uri imageUri = Uri.fromFile(new File(imagePath)); Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW);

Is there a Bookmark Contentprovider for Chrome to get browser history

有些话、适合烂在心里 提交于 2019-12-06 04:26:21
I have an app that use ContentResolver to get the Browser history data with Browser.BOOKMARKS_URI. It works well with the stock Android browser. Now Google is moving to Chrome as the default browser. Does Chrome provide similar Contentprovider? I searched all over the web but could not find any information on this. Is there a doc for Chrome on Android released by Google yet? Thanks in advance! https://groups.google.com/a/chromium.org/forum/?fromgroups=#!topic/chromium-bugs/ThAoOAYOPCk indicates that this should now be possible. If Chrome is the system default browser (which it should be in

How to securely share data between two or more applications in android?

徘徊边缘 提交于 2019-12-05 22:58:31
问题 I am making an application framework for the enterprise environment which involves data sharing between two or more applications from the device memory . This data needs to be stored on the device and accessible to only a few applications (which can be identified by the certificates used to install them) . Also, it needs to be stored in a secure way so as to be not accessible to other third party applications . Which is the best way to implement this functionality ? I have read up about

Get real path from Uri - DATA is deprecated in android Q

孤人 提交于 2019-12-05 21:37:38
I'm successfully implementing a method for retrieving the real path of an image from gallery by the Uri returned from ACTION_PICK intent. Here's a sample: // getRealPathFromURI(intent.getData()); private String getRealPathFromURI(Uri contentURI) { String result; Cursor cursor = getContentResolver().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similar local file path result = contentURI.getPath(); } else { cursor.moveToFirst(); int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); cursor.close(); }

Android: getContext().getContentResolver() sometimes gets NullPointerException

偶尔善良 提交于 2019-12-05 19:50:36
问题 I want to ask why we get this annotation: Method invocation getContext.getContentResolver() may produce NullPointerException Why is it there and not in other parts of program Fragment/Activity? That approach has been used in tutorial made by Google - here is link for ContentProvider code https://github.com/udacity/Sunshine-Version-2/blob/sunshine_master/app/src/main/java/com/example/android/sunshine/app/data/WeatherProvider.java even if you create an aplication with just a blank activity and

How to update genre in mediastore?

那年仲夏 提交于 2019-12-05 07:45:32
I'm trying to update the genre tag of an audio file. CODE final Uri genreUri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI; String currentGenreName = MediaStore.Audio.Genres.NAME; ContentValues values2 = new ContentValues(); values2.put(currentGenreName, genre); String whereGenre = MediaStore.Audio.Genres._ID + "=?"; String[] whereVal2 = {Long.toString(genreID)}; resolver.update(genreUri, values2, whereGenre, whereVal2); genre : value from edittext (new genre name). genreID : genreID from selected audio file. I'm not getting any errors, but the genre doesn't update in the MediaStore genre

Using ContentResolver instead of ContentProviderClient in SyncAdapter

让人想犯罪 __ 提交于 2019-12-05 06:29:23
As I understand from the docs, one SyncAdapter defined in a SyncService is limited to receive only one ContentProvider authority to work on. But, at the same time, it has access to ContentResolver which it allows to run queries on other ContentProviders as well. I don't understand this particular design concept if a developer is needed to provide a single content authority to SyncAdapter and nonetheless she is able to do whatever she wants on whatever ContentProvider she has access to. My question is: What are the consequences of ignoring onPerformSync's parameters: String authority and

Does ContentResolver notifyChange method notifies also detail Uri's?

一曲冷凌霜 提交于 2019-12-05 03:45:47
During applying data I use notifyChange with an Uri . Let's say I notify content://com.package.my/items . I have also detail Activity that displays data from content://com.package.my/items/1 . Does notifying 'general' Uri results also in 'detail' Uri being notified? thaussma The method notifyChange sends a notification for the detailed URI. But if you register a ContentObserver at ContentResolver.registerContentObserver(Uri uri, boolean notifyForDescendents, ContentObserver observer) you can register a base Uri to be notified if any descendant Uri has been changed (is used to send change

Android - Find a contact by display name

拜拜、爱过 提交于 2019-12-05 01:41:50
I'm trying to find a contact by display name. The goal is to open this contact and add more data to it (specifically more phone numbers), but I'm struggling to even find the contact I want to update. This is the code I'm using: public static String findContact(Context context) { ContentResolver contentResolver = context.getContentResolver(); Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI; String[] projection = new String[] { PhoneLookup._ID }; String selection = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " = ?"; String[] selectionArguments = { "John Johnson" };