onClick start new activity android



I have a little problem with action bar item. I want to create clicable item in action bar which opens new java activity.


ab_button_desktop is the custom button which I created. I tried a lot java codes from tutorials and I havent still any resoults. Could anyone recommend me java code which opens new activity.


This is my xml.



<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://ift.tt/nIICcg" xmlns:webviewapp="http://ift.tt/GEGVYd">
<item
android:id="@+id/ab_button_desktop"
android:title="@string/ab_button_desktop"
android:icon="@drawable/ic_menu_desktop"
android:orderInCategory="1"
android:onClick="desktop"
webviewapp:showAsAction="always" />
<item
android:id="@+id/ab_button_share"
android:title="@string/ab_button_share"
android:icon="@drawable/ic_menu_share"
android:orderInCategory="1"
webviewapp:showAsAction="ifRoom" />

</menu>

No comments:

Post a Comment