Custom shared button

38 views
Skip to first unread message

ro...@catsys.ru

unread,
Oct 20, 2014, 3:22:51 AM10/20/14
to codenameone...@googlegroups.com
Hello, 
I'm just starting to learn codenameone (java too). Can't find any example or articles on how to add a button to the system menu to share in photo viewer.

PS
Use java in codenameone.

Shai Almog

unread,
Oct 20, 2014, 7:52:28 AM10/20/14
to codenameone...@googlegroups.com, ro...@catsys.ru
Hi,
when you say system menu do you mean the Android menu in the top right corner (action bar) or something else?
You can add a ShareButton component rather easily but to place it in the menu is a bit more tricky.

ro...@catsys.ru

unread,
Oct 20, 2014, 8:20:43 AM10/20/14
to codenameone...@googlegroups.com, ro...@catsys.ru
Excuse me, for me is difficult to properly express themselves in a foreign language. I meant to share the menu while viewing photos standard OS tools. In the android is on the top left and bottom left is Ios.

Shai Almog

unread,
Oct 20, 2014, 9:15:42 PM10/20/14
to codenameone...@googlegroups.com, ro...@catsys.ru
I suggest you use a screenshot to illustrate what you are trying to accomplish.
Generally to add an item to the menu you can just use addCommand and you can give it the share icon. To actually perform the share operation for Android/iOS you can use the share API's available in the Display class.

ro...@catsys.ru

unread,
Oct 21, 2014, 3:39:30 AM10/21/14
to codenameone...@googlegroups.com, ro...@catsys.ru
http://awesomescreenshot.com/0863p34f71

I want to share photos through my program. Want to add your button to the system menu to "share". 

PS 
Is it possible to somehow "convert" application written for Android in codenameone?


вторник, 21 октября 2014 г., 5:15:42 UTC+4 пользователь Shai Almog написал:

Chen Fishbein

unread,
Oct 21, 2014, 4:19:12 AM10/21/14
to codenameone...@googlegroups.com, ro...@catsys.ru
You need your app to be registered as an app that knows how to handle images, you can do that using the intent-filters build argument.
Something like this should do the trick:

android.xintent_filter=<intent-filter>                      
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />                      
    <data android:mimeType="image/*" />
</intent-filter>

Reply all
Reply to author
Forward
0 new messages