android-contentprovider

How to open attachment list of media?

余生颓废 提交于 2019-12-03 15:02:38
In Android messaging, when click on attach it open the list of content provider like Camera, Gallery, Audio, Video etc . How to open the same list on button click? Like this : Femi What you want is actually a little complex: you need to call a method like this in your Activity private void showAddAttachmentDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setIcon(R.drawable.ic_dialog_attach); builder.setTitle(R.string.add_attachment); AttachmentTypeSelectorAdapter mAttachmentTypeSelectorAdapter = new AttachmentTypeSelectorAdapter(this,

Android: Get updated and deleted contact only

我只是一个虾纸丫 提交于 2019-12-03 14:46:39
问题 I am developing an application in which i am working on Android Contacts and not able to move ahead. In app the need of application is that the contact which is updated should send to server or the contact which is deleted should send to server for sync. I am using the contact service as: public class ContactService extends Service { private int mContactCount; Cursor cursor = null; static ContentResolver mContentResolver = null; // Content provider authority public static final String

Difference between Shared Preferences and Content Providers in android

ε祈祈猫儿з 提交于 2019-12-03 14:44:06
I know partially about Shared preferences and intents.But i want to know what are shared preferences and content providers in android ? And also what is the basic difference between intents , shared preferences and content providers . Please explain me this. shared preferences are the location where you can store the secret information for your app, like setting cookies in the browser, this can be used for login credentials and other. where as content provider stores and retrieves the data and make it available to other applications also. like suppose you want to access the contacts available

How to implement a content provider with more than one table?

蹲街弑〆低调 提交于 2019-12-03 14:15:19
问题 update: looking at "vnd.android.cursor.dir/vnd.google.note" and "vnd.android.cursor.item/vnd.google.note" it seemed to me as though the cursor was for one table. From the examples it appears as though content provider were designed to work with one table. I do know how to use multiple tables in sqlite but it seems to me that the content provider seems to be about picking one row or multiple rows from one table. see http://developer.android.com/guide/topics/providers/content-provider-creating

How to provide content for Intent.ACTION_GET_CONTENT

陌路散爱 提交于 2019-12-03 13:51:39
The web and stackoverflow contain several examples how to get a file from another Android app (e.g., to use it as email attachment) using an ACTION_GET_CONTENT intent. But what kind of class do I have to implement to create an application providing content for the ACTION_GET_CONTENT event such as I can choose this app (e.g., for selecting an email attachment). Is a ContentProvider the right solution? And what do I have to add to my AndroidManifest.xml? After some hours of web search I found the following solution. Implement an Activity handling intents. Within, use the following or more

Find and interate all SMS/MMS messages in android

折月煮酒 提交于 2019-12-03 13:50:57
问题 First and foremost, I found this answer particularly helpful. However, it made me wonder how one goes about finding such information. I can't seem to figure out how to iterate all the messages in my inbox. My current solution uses Uri.parse("content://mms-sms/conversations") in which I give use "_id" and "ct_t". However, it seems I only find the three conversations in my phone despite having 30 msges (20 of them in the save conversation thread and the others divided between two other

How to create a new Playlist using ContentResolver

情到浓时终转凉″ 提交于 2019-12-03 13:21:19
I'm attempting to create a new Playlist , using Android's ContentResolver , that will be added to music player's playlists, but when the code runs, the insert into the playlist returns null (for the Uri ) and when I check the music player's playlists, my new Playlist entry isn't there. I suspect that the reason that the insert() returns null is because I haven't created the Playlist correctly. Could someone clarify how to dynamically create a new playlist, given that my code doesn't work. (In my searching, I've found several way to query playlists, but nothing actually creates a new one) Here

How to implement complex queries using a Content Provider?

浪子不回头ぞ 提交于 2019-12-03 12:15:30
问题 I am asking this because I am not quite sure of how to work with Android Content Providers. I have a subset of my database with 8 tables and I need to create complex queries to get some of the data. My content provider works fine with simple queries. For example, I have a table Person on my PersonModel.java class and I get the data using: String [] projection = {PersonModel.C_FIRST_NAME, PersonModel.C_LAST_NAME}; Cursor cursor = context.getContentResolver().query( MyProvider.CONTENT_URI

How to load a Picasa image from URI?

余生颓废 提交于 2019-12-03 12:01:01
问题 I'm using ACTION_PICK intent to select an image from gallery. Some albums like "Posts" , "Profile Photos" , etc are marked with Picasa icon. For images from such albums I get a URI similar to this: content://com.google.android.gallery3d.provider/picasa/item/5769844615871490082 I can load an image from this URI using ContentResolver and BitmapFactory with no problem: final InputStream ist = context.getContentResolver().openInputStream(intent.getData()); final Bitmap bitmap = BitmapFactory

Android camera intent FileUriExposedException for SDK >= 24

安稳与你 提交于 2019-12-03 11:50:39
问题 I use this code to get a picture from camera and put it on imageview: private void openCamera() { mMediaUri =getOutputMediaFileUri(MEDIA_TYPE_IMAGE); Intent photoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); photoIntent.putExtra(MediaStore.EXTRA_OUTPUT, mMediaUri); startActivityForResult(photoIntent, REQUEST_TAKE_PHOTO); // dialog.dismiss(); } private Uri getOutputMediaFileUri(int mediaTypeImage) { //check for external storage if(isExternalStorageAvaiable()) { File mediaStorageDir =