Hello developers have you ever faced a problem, that your share icon in gallery or any other place in your android device (say file manager) is not enabled i.e it is not clickable, while porting your own android source in your own device. If so here is the solution for that.
when you move to the packages section of your android source you will find the source code for Gallery2 in your apps directory.
That is i'm mentioning this spot in your system
Android_source/Packages/apps/Gallery2
In this you will have all the layouts, resources, java codes necessary to execute Gallery2.apk in your System/app directory of your device.
here is what you have to change. Go to res/menu/photo.xml in your Gallery2 directory where you will find this snippet to invoke Share Provider in the Action Bar.
<item android:title="@string/share"
android:visible="false"
android:showAsAction="ifRoom"
android:icon="@drawable/ic_menu_share_holo_light"
android:id="@+id/action_share"
android:actionProviderClass="android.widget.ShareActionProvider"
android:enabled="true"/>
The Attribute showAsAction is responsible for this. Down below this snippet you will find the snippet for the delete icon where which is given higher priority than share and hence share is not responding since DELETE is given room.
We are going to change showAsAction attribute to "always" so that share is enabled.
Change the above snippet as follows.
<item android:title="@string/share"
android:visible="false"
android:showAsAction="always"
android:icon="@drawable/ic_menu_share_holo_light"
android:id="@+id/action_share"
android:actionProviderClass="android.widget.ShareActionProvider"
android:enabled="true"/>
Once this is done run the Makefile in the Gallery2 directory. That will produce the output apk file in the directory Android_source/out/target/product/device_name/system/app/Gallery2.apk
transfer this apk file to the system/app directory of your device.
It will work fine!!!!!!!!!!
Author
Hari Prasath G
Project Engineer
No comments:
Post a Comment