On Apr 25, 8:55 pm, Dianne Hackborn <hack...@android.com> wrote: > On Tue, Apr 26, 2011 at 12:46 AM, Paul <pmmen...@gmail.com> wrote: > > > > share.setType(getString(R.string.note_default_mime_png)); > > > There is no reason for this string to come from a resource; it is not > > > something that gets localized, it is just a constant. > > I am storing it in the XML as a way of storing the value... any other > > standard conventions that are recommended? Store this as a static > > constant in a static 'settings' class maybe? > > Just a static constant is fine. For > example:http://developer.android.com/reference/android/provider/MediaStore.Au... >
Ok, thanks > > > ACTION_SEND is not specified to return anything, so if you are getting > > any > > > result at all you can't count on what you get back being useful. > > I'm not counting on it returning anything useful, just having the > > functionality indicate that it has finished is enough, I am then > > setting a boolean field to true when it does, so that I know I that > > the app has created a temporary copy of the file in the app's cache > > directory. On exiting the program, if the field is true, I then empty > > the cache directory. Obviously don't need to do this if I am no > > longer copying the file if/when I get the method you suggest using > > onFile() to work. > > This may not be a safe assumption. For example the send will often take a > while, so an implementation may very likely exit once the send has been > confirmed and execute the operation in a background service. Well if I can get the openFile override working, I won't need to use the cache directory and won't need this at all, so this shouldn't be an issue moving forward. > > > On that front, I have overriden the onFile() method in my content > > provider, but it is not being triggered by the above code, any > > suggestions? > > @Override > > public ParcelFileDescriptor openFile(Uri uri, String mode) { > > Log.d(LOG_TAG, "openFile() called"); > > return null; > > } > > Have you published the content provider in your manifest and ensured you > have set the authority correctly there in and the Intent's URI? Have you > tried opening it yourself to see if it works? Is anything interested > printed in the log? The content provider is published in my manifest: <provider android:name=".provider.MyProvider" android:authorities="package.name.here" android:exported="true" /> I am using it for all DB activity in my app, so it's working... and have tried the following, and no errors are generated: getContentResolver().openFileDescriptor(Uri.fromFile(shareFile), "r"); But... this does not trigger a call to openFile(). As I've switched over to passing the SEND the path directly to my file in the app's file directory, versus the path to the one I was copying to my cache directoy, the Uri for this is now: /data/data/package.name/files/1.png I get a permissions error now (as expected), but again, no call to openFile(). > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en