android-contentprovider

Create and Share a File from Internal Storage

送分小仙女□ 提交于 2019-11-26 15:22:47
My goal is to create a XML file on internal storage and then send it through the share Intent. I'm able to create a XML file using this code FileOutputStream outputStream = context.openFileOutput(fileName, Context.MODE_WORLD_READABLE); PrintStream printStream = new PrintStream(outputStream); String xml = this.writeXml(); // get XML here printStream.println(xml); printStream.close(); I'm stuck trying to retrieve a Uri to the output file in order to share it. I first tried to access the file by converting the file to a Uri File outFile = context.getFileStreamPath(fileName); return Uri.fromFile

How to query Android MediaStore Content Provider, avoiding orphaned images?

柔情痞子 提交于 2019-11-26 15:13:45
问题 I'm trying to provide an in-app Activity which displays thumbnails of photos in the device's media store, and allow the user to select one. After the user makes a selection, the application reads the original full-size image and does things with it. I'm using the following code to create a Cursor over all the images on the external storage: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView( R.layout.image_select ); mGridView = (GridView)

how to get contact photo URI

放肆的年华 提交于 2019-11-26 14:23:29
问题 I am working with Android Contact ContentProvider. I have a Phone Number and I need to get the URI of the Photo of the contact associated with this phone number. How can I do it??? I know I can get the raw data of the photo and build an InputStream , but I dont want the input stream, I need the URI . EDIT: Originally I'm using following code to fetch contact info Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNo)); Cursor cursor = context.getContentResolver()

get the last picture taken by user

…衆ロ難τιáo~ 提交于 2019-11-26 12:26:40
问题 hey I want to get the last picture captured by user through any camera application. I have no idea how to do that can any one help me? further I want to send that image as an attachment to an email or MMS.. thanks 回答1: // Find the last picture String[] projection = new String[]{ MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA, MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, MediaStore.Images.ImageColumns.DATE_TAKEN, MediaStore.Images.ImageColumns.MIME_TYPE }; final

Install shows error in console: INSTALL FAILED CONFLICTING PROVIDER

♀尐吖头ヾ 提交于 2019-11-26 12:06:30
I am experimenting with the NotesList sample program in the Android SDK. I've made a slight variation in the program, but when I install my edited version I keep getting the message INSTALL_FAILED_CONFLICTING_PROVIDER in the console when I try to install it when the original notes program is already on the device. What do I need to change in the Provider to make it a unique database? It works fine if I uninstall the original notes program and then install my edited version. The authority, as listed in android:authorities must be unique. Quoting the documentation for this attribute : To avoid

How to check database on not rooted android device

自闭症网瘾萝莉.ら 提交于 2019-11-26 12:04:21
问题 I am developing an app where i am using sqllite3 database to store values. I have Nexus S and Nexus 7 both are unrooted devices. How can i get the database for my app for debugging purpose. I have tried (1) I have tried all approach mentioned here adb shell run-as app.package.name \\ cp /data/data/package.name/databases/application.sqlite /sdcard/ exit adb pull /sdcard/application.sqlite ~/ This says cp not found.. (2) http://developer.android.com/tools/help/adb.html#sqlite adb -s emulator

SyncAdapter without a ContentProvider

有些话、适合烂在心里 提交于 2019-11-26 12:02:28
问题 I want to implement a SyncAdapter for a content I want to synchronize with a server. It seems that to do so, you need a ContentProvider registered for the authority you specify in the SyncAdapter XML property file. As I don\'t want this content to be accessible to the rest of the phone, I haven\'t implemented my own ContentProvider and used a personal implementation to store this content. Do you know if it is possible to provide a synchronization using a SyncAdapter without providing a

What are the semantics of withValueBackReference?

泄露秘密 提交于 2019-11-26 11:55:50
问题 I cannot figure out the exact semantics of withValueBackReference. I\'ve read the example code (for example the code which adds a new contact) using this method, providing a backReference value of 0. What does this mean? The documentation says: A column value from the back references takes precedence over a value specified in withValues(ContentValues) 回答1: This question relates to batch operation on a content provider. The example is modified from this related question. When creating a batch

Why does ContentResolver.requestSync not trigger a sync?

只愿长相守 提交于 2019-11-26 11:00:07
I am trying to implement the Content-Provider-Sync Adapter pattern as discussed at Google IO - slide 26. My content provider is working, and my sync works when I trigger it from the Dev Tools Sync Tester application, however when I call ContentResolver.requestSync(account, authority, bundle) from my ContentProvider, my sync is never triggered. ContentResolver.requestSync( account, AUTHORITY, new Bundle()); Edit -- added manifest snippet My manifest xml contains: <service android:name=".sync.SyncService" android:exported="true"> <intent-filter> <action android:name="android.content.SyncAdapter"

How to store large blobs in an android content provider?

一曲冷凌霜 提交于 2019-11-26 10:59:26
问题 I have some large files (images and video) which I need to store in a content provider. The android documentation indicates... If you are exposing byte data that\'s too big to put in the table itself — such as a large bitmap file — the field that exposes the data to clients should actually contain a content: URI string. This is the field that gives clients access to the data file. The record should also have another field, named \"_data\" that lists the exact file path on the device for that