android-contentprovider

Trouble writing internal memory android

做~自己de王妃 提交于 2019-12-18 12:45:46
问题 void launchImageCapture(Activity context) { Uri imageFileUri = context.getContentResolver() .insert(Media.INTERNAL_CONTENT_URI, new ContentValues()); m_queue.add(imageFileUri); Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri); context.startActivityForResult(i, ImportActivity.CAMERA_REQUEST); } The above code, which has always worked, is now generating this exception for me at insert(). java.lang

How can I refresh the cursor from a CursorLoader?

*爱你&永不变心* 提交于 2019-12-18 12:08:06
问题 So I have my MainDisplayActivity which implements both Activity and LoaderManager.LoaderCallbacks<Cursor> . Here I have A ListView , which I fill with Agenda information that I get from my database using a ContentProvider. I also have a GridView which is a calendar. I have it set up when clicking a cell, that the agenda is updated with the day clicked. My problem is that when reusing the Loader I created in onCreate() inside of the setOnItemClickListener(), it does not refresh the information

What to set CursorAdapter(Context context, Cursor c, int flags) to in order to make it work with CursorLoader?

耗尽温柔 提交于 2019-12-18 11:27:26
问题 The google docs point out not to use the CursorAdapters first constructor, CursorAdapter(Context context, Cursor c) There are only two other options, CursorAdapter(Context context, Cursor c, boolean autoRequery) which says Constructor that allows control over auto-requery. It is recommended you not use this, but instead CursorAdapter(Context, Cursor, int). When using this constructor, FLAG_REGISTER_CONTENT_OBSERVER will always be set.` and CursorAdapter(Context context, Cursor c, int flags)`

How to create a Thread-safe ContentProvider?

自闭症网瘾萝莉.ら 提交于 2019-12-18 11:18:27
问题 Android documentation says ContentProvider methods can be called from various ContentResolver objects in different processes and threads, they must be implemented in a thread-safe manner And I found this post on Stackoverflow Android - sqlite content providers and multithreading which says it's thread safe already ?? So, Just wondering how to create a thread-safe ContentProvider ? Is it enough if I make the insert/update/delete methods syncronized public synchronized Uri insert (Uri uri,

Failed to find provider info for 'ContentProvider'

≯℡__Kan透↙ 提交于 2019-12-18 11:02:34
问题 I have a problem that I just cannot figure out. I am using Eclipse to create my own Content Provider but keep getting the following error: [..] ERROR/ActivityThread(1051): Failed to find provider info for my.package.provider.countrycontentprovider Code found here: http://codepad.org/Rx00HjHd Main parts: public class CountryContentProvider extends ContentProvider { public static final String PROVIDER = "my.package.provider.countrycontentprovider"; public static final Uri CONTENT_URI = Uri

Permisssion denied while attaching apk file with GMail app android

南笙酒味 提交于 2019-12-18 09:48:06
问题 I have a requirement to send a apk file through share Intent and I have also implemented without any hassle. But the problem arises only while sending apk via GMail, I am getting permission denied while i try to attach. I really dont know what is happening with GMail. Kindly help me through your answers and solutions. Any Small hint and tips would also be useful for me. Thanks in advance I am using following code to send APK using shared intents: public static void appSend(ArrayList<File>

Calendar event intent - startActivityForResult

不羁的心 提交于 2019-12-18 06:56:22
问题 I want to create an event into the calendar from my app. I can start a new event activity with: Intent intent = new Intent(Intent.ACTION_EDIT).setData(uri); intent.setType("vnd.android.cursor.item/event"); startActivityForResult(intent, REQUEST_ID); Is it possible to get the ID of the created event ? OnActivityResult resultCode is always 0 - whether I create the event or not. The data is always null. Is there some way to do it? 来源: https://stackoverflow.com/questions/11508511/calendar-event

Make exception event from original recurring event?

爷,独闯天下 提交于 2019-12-18 04:23:22
问题 I found that Events.CONTENT_EXCEPTION_URI (here) used for make recurring event. It's hardly to find document or code example from internet. So I try many ways 1 Insert as SyncAdapter ContentValues values = new ContentValues(); values.put(Events.ORIGINAL_INSTANCE_TIME, CaldavGlobalVar.getCurrentTime_()); values.put(Events.SELF_ATTENDEE_STATUS, status); if(!username.equals("")){ values.put(Events.ORGANIZER, username); } if(event.getSummarry()!=null){ values.put(Events.TITLE, event.getSummarry()

Passing binary blob through a content provider

对着背影说爱祢 提交于 2019-12-18 04:13:10
问题 I have a content provider that is custom to my set of Android applications, and one of the things it needs to expose is a small (20-30 KiB) byte array. The URI for these blobs looks like: content://my.authority/blob/# where # is the row number; the resulting cursor has the standard _id column and a data column. I'm using a MatrixCursor in the provider's query() method: byte[] byteData = getMyByteData(); MatrixCursor mc = new MatrixCursor(COLUMNS); mc.addRow(new Object[] { id, byteData });

Android Browser.BOOKMARKS_URI does not work on all devices. How to find out the correct uri for a given device?

强颜欢笑 提交于 2019-12-17 19:29:16
问题 I am trying to use Android Browser.BOOKMARKS_URI to CRUD device bookmarks from within my app ( https://play.google.com/store/apps/details?id=com.elementique.web ) It's working fine on most of the devices, but does not work on some :-( On those devices, trying to use bookmarks leads to java.lang.IllegalArgumentException: Unknown URL content://browser/bookmarks I now understand that Boookmark Uri can be different than the AOSP default value (i.e. "content://browser/bookmarks"). Question: How