Share image with FileProvider or MediaStore - mediastore

I have to following problem. I want to share an image using intent chooser to the as many apps as possible. To achieve that I have two options:
Save the image to MediaStore. But that means that image will show up in the gallery without user's granting it.
Or share the image using using FileProvider. But if I use FileProvider some apps don't work and throw the following exception:
java.lang.IllegalStateException: Couldn't read row 0, col 0 from
CursorWindow. Make sure the Cursor is initialized correctly before
accessing data from it.
at android.database.CursorWindow.nativeGetLong(Native Method)
at android.database.CursorWindow.getLong(CursorWindow.java:507)
at android.database.AbstractWindowedCursor.getLong(AbstractWindowedCursor.java:75)
at android.database.CursorWrapper.getLong(CursorWrapper.java:106)
at ehz.a(PG:175)
at duj.a(PG:540)
at com.google.android.apps.photos.phone.SendContentActivity.onClick(PG:177)
at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
at dalvik.system.NativeStart.main(Native Method)
Working FileProvider would be perfect for me because with .nomedia option I can hide the image from Gallery and still share image to all the other apps.
Did anyone manage to solve this? Is there another option to share an image that can be accessed to all the other apps?
Thanks

Saved the problem. Instead of all the options I've used Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) and created subdirectory with .nomedia and it worked.

Related

Cannot create class-file Android Studio

I'm trying to integrate Google Calendar API into my android project and I follow the tutorial here
https://developers.google.com/google-apps/calendar/quickstart/android
At step 5 create a new java class
I right click project folder src>main>java>com>example>utarapp and then new>file and entered the file name but then it has this error
What's going on ?
I'm using android studio 1.3.1
I think you are trying to create file with same name which is already present in the same package. This may be one possible reason.
It seems like you are right-clicking on the upper level in your application's directory tree.
Right click on one of the files inside the utarapp folder and then select Java class option from the menu.
For me this was happenning because of the length of the class name. In my case it was "ChallengesFragmentPagerAdapter"!
Changing it to "ChallengesPagerAdapter" solved the problem.
Create a blank Activity then remove "extends Activity" from the activity class.

Questions about Citymaps

1、I want to create a circle and set an image that customized to fill the circle,use this as a marker on the map, not only could change the image but also the color of circle anytime,what can I do to implements this function? Please look at the picture below!
2、Like your CityMaps app show,when I enlarge the map, some business icon that hide are show on the map,which are hide again while shrink the map, How to achieve this effect?
3、After I initialization the Object Marker and called the method marker.setFadeTime(3000),the software give my tips the method is no exist and I see the class Marker.java but really not find the method,Why is it so?
4、I want to add some stars beside the marker like this:
What can I do to add the stars?the label only can set the text beside the marker.
5、I want to load your maps at the fragment,not the activity that extends FragmentActivity,I found the SupportCitymapsMapFragment is no use,What I can do to complete this requirement?
6、In your apps,it is locate that place after input New York in the search box,What can i do to complete this function whatever i input?
7、During I develop the apps about the Citymaps,I found a serious problem so that your apps had happend too. When I run the apps, the program force flash back all of a sudden and I run your apps Citymaps at this time,the problems are same of the front,I found some error in logical view that is follows:15327-15374/com.map.maplbs A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 15374 (Thread-1819).
To solve the problem,I must restart my device. Why is it so?
I am a developer on the Citymaps SDK, I will do my best to answer your questions.
1) I recommend using the Android Canvas API to construct the images, and then use a Marker to display it on the map. See the documentation for details: http://developer.citymaps.com/markers
2) This is built into the Citymaps BusinessLayer. This functionality is not exposed through an API. If you wish to use the Citymaps BusinessLayer, you should create a CitymapsMapView or CitymapsMapFragment/SupportCitymapsMapFragment and it will automatically be added to your map.
3) At this time, there appears to be a known issue with the fadeTime API. Thank you for bringing this to our attention. We will fix it in an upcoming release. For now, you can animate the alpha property of the Marker.
4) Once again, the functionality of the BusinessLayer is not directly exposed. If you wish to create similar markers, I recommend you construct the image using Android's Canvas and then adding it as a Marker to the map.
5) If you wish to load the map inside of a fragment, you can accomplish this using child fragments (check Android documentation for more details). You can also accomplish this by instantiating CitymapsMapView or MapView directly and adding it to your view hierarchy either in XML or in code. However if you do this, remember to call the lifecycle methods on your map instance, or else the map will not behave properly.
6) If you wish to have a search in your app, it is up to you to implement this feature. We do not currently provide a search API out of the box.
7) Thank you for the bug report. We will investigate this issue and fix it in a future release.
If you have any more questions, feel free to ask, and thank you for using the Citymaps SDK.

I get "java.lang.RuntimeException: Unable to start activity ComponentInfo" when importing custom view

I am trying to use custom view from "tutorial How to take advantage of the pinch-to-zoom feature in your Xperia™ X10 apps – Part 2" here, I copied the classes related to the custom view to the project. The custom view appears in xml editor->graphical layout->custom & library views, when I drag/drop it into the layout I get :
java.lang.NullPointerException
The logcat shows this:
FATAL EXCEPTION: main
12-31 01:00:19.819: E/AndroidRuntime(4554): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yav.android/iv.GeneralImageview}: java.lang.NullPointerException
The question is how to make eclipse see this custom view class?

White Screen during loading the ViewBasedApplication in iphone

I am new to iPhone. I have Develop one aplication that is of ViewBased Application.
Everything is right but while i run the application, instead of showing list of content it shows the white screen. After doing studies come to know that it may be for the XIB file references. As my code is right at all. So will u tell me while it appear like it ?
Thanks in advance.
check your .xib file and see whether you have link it to datasource and delegate or not.
Check your xib and properly check inteface builder that a datasource and delegate is set or not. for showing a view you have to set datasource and delegate..and also you have to check in appdelegate file that a object of your view controller have been made or not... i.e. you have to allocate memory of your view controller in app delegate file..

Drop and Show files in WPF

How to Drop an image from Client Computer to WPF app.
For example dropping image file from a folder or desktop to WPF app and the dropped image should be saved and showed in that dropped window as just an image.
I've searched here similar questions to my question and I couldn't find what I need.
Please help me!
Thank you in advance :)
In target element (or at the window level) set the AllowDrop property to true. Then provide the element or window the DragDrop event handler.
In the event handler you will be able to get the filepath with something like:
e.Data.GetData(DataFormats.FileDrop, true)
Now that you know the location of the file you can do what you like with it.

Resources