android-contentprovider

Sharing images from internal storage using FileProvider

丶灬走出姿态 提交于 2019-12-09 11:40:23
问题 I have some files stored in my application's internal storage that I would like to open in an external application (sending an image to the Gallery for viewing, for example.) I've set up a FileProvider to do so. From AndroidManifest.xml : <application> ... <provider android:name="android.support.v4.content.FileProvider" android:authorities="${packageName}" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android

ContentProvider with multiple tables

拜拜、爱过 提交于 2019-12-09 11:00:25
问题 I want to implement a ContentProvider that manipulates multiple tables. Here is what I tried so far. I wrote a Java Interface that represents the CRUD operations that every table should implement in its CRUD class. public interface CRUDHandler { //UPDATE int update(Uri uri, ContentValues values, String selection,String[] selectionArgs); //READ Cursor query(Uri uri, String[] projection, String selection,String[] selectionArgs, String sortOrder) ; //CREATE Uri insert(Uri uri, ContentValues

How do I restrict access to my ContentProvider to only my apps?

给你一囗甜甜゛ 提交于 2019-12-09 07:33:17
问题 I want to export a ContentProvider for use by another one of MY apps. How do I prevent other apps from accessing it? If I use an android:permission attribute, can't 3rd party apps just apply that permission to their app? I really need to lock down access to my apps only. Thanks in advance... 回答1: If I use an android:permission attribute, can't 3rd party apps just apply that permission to their app? Well, you can use a signature -level custom permission ( android:protectionLevel="signature" ).

Android History Content Observer

依然范特西╮ 提交于 2019-12-09 06:53:59
问题 I implemented content observer of history but it is behaving weird.For every change in history its onChange() function runs 3-5 times. static class BrowserOberser extends ContentObserver { public BrowserOberser() { super(null); } @Override public boolean deliverSelfNotifications() { return true; } @Override public void onChange(boolean selfChange) { super.onChange(selfChange); Log.d("History", "onChange: " + selfChange); } } I also registered my observer using BrowserOberser observer = new

Can I extend Androids Contacts database?

孤街醉人 提交于 2019-12-09 05:01:35
问题 I was wondering is it possible to extend the Android Contacts database? From here - http://d.android.com/reference/android/provider/ContactsContract.html It says: ContactsContract defines an extensible database of contact-related information Extensible would suggest to me that I can add in more data to the contacts application outside the normal values such as Name, number, email, work number, home number etc.. However the examples of this page - http://d.android.com/reference/android

How resize image from gallery?

為{幸葍}努か 提交于 2019-12-09 02:12:25
问题 The first file allow the user to pick a photo from the gallery and sends it to an activity which will process it. The problem is that the image is too large for the phone's screen, so you only see the top corner of the image(as if it has been magnified). Button useGallery = (Button)findViewById(R.id.loadfromgallery); useGallery.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent

How to implement read-only ContentProvider?

こ雲淡風輕ζ 提交于 2019-12-08 21:15:13
问题 I am wondering how to best implement a read-only ContentProvider. I want my data source to be modified only from within my own application through additional special methods of my ContentProvider (which of course are not accessible through a ContentResolver). In other words, other applications should only be able to use my ContentProvider's query method but not insert, delete, or update. The obvious solution seems to be to just return null/0/0 and do nothing else in insert/delete/update.

Get Android contacts with type-to-filter functionality, restricted to a specific account

荒凉一梦 提交于 2019-12-08 19:11:58
问题 I'm trying to: Display a list of contacts Let the user search through them by typing a query Limit search results only to a specific Google/Gmail account. This is how I build the URI for the cursor: // User is searching for 'jo' String query = "jo"; Uri uri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(query)); // Restrict the query to contacts from 'example@gmail.com' Uri.Builder builder = uri.buildUpon(); builder.appendQueryParameter( ContactsContract.DIRECTORY_PARAM_KEY,

Unable to find resource ID - Android Gradle Plugin 3.4.0

时间秒杀一切 提交于 2019-12-08 15:55:56
问题 When moving from Android Gradle Plugin 3.3.2 in a multi module project to 3.4.0 and executing connectedAndroidTest I see a fatal exception. A Google Play Services shared class StringResourceValueReader looks for a resource common_google_play_services_unknown_issue but fails to find it. The error is as follows: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0f0044 at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:236) at android

How to create Cursor data without getting data from the DataBase in Android application?

痞子三分冷 提交于 2019-12-08 15:38:22
问题 In my Android application, I am using Sqlite DataBase to store the data from the server. I am using ContentProvider and ContentResolver to access the data from the DataBase and using CursorAdapter to bind the data to the ListView. As soon the data is inserted into the DataBase, CursorAdapter will be notified to update the ListView. Also, whenever I scroll the ListView, I get new data from the DataBase table and ListView will be updated. But once I reaches to the end of the table row, I need