Click here to Skip to main content
14,456,102 members
   

Android

 
QuestionUnfortunately app has stopped Pin
Kevsh10hrs 52mins ago
MemberKevsh10hrs 52mins ago 
AnswerRe: Unfortunately app has stopped Pin
Richard MacCutchan9hrs 59mins ago
communityengineerRichard MacCutchan9hrs 59mins ago 
QuestionConversion file backup .csv to file backup Crypt5 or Crypt12 Pin
Oderisio13-Feb-20 6:46
MemberOderisio13-Feb-20 6:46 
Rant[REPOST] Conversion file backup .csv to file backup Crypt5 or Crypt12 Pin
Richard Deeming13-Feb-20 7:46
communityengineerRichard Deeming13-Feb-20 7:46 
QuestionMessage Closed Pin
7-Feb-20 23:05
MemberMember 147386787-Feb-20 23:05 
QuestionMessage Closed Pin
7-Feb-20 23:03
MemberMember 147386787-Feb-20 23:03 
QuestionMessage Closed Pin
7-Feb-20 7:11
MemberMember 147382887-Feb-20 7:11 
QuestiononOptionsItemSelected go to a website Pin
The_Arcaniac1-Feb-20 23:30
MemberThe_Arcaniac1-Feb-20 23:30 
Hello, and thank you for you patience with me. I am knew to Android, however I have been programming LAMP and Visual Basic and C# for many years.

I am using Android Studio 3.5 and using Kotlin as the language.

I have a very simple question for many of you, however, it is vexing me. I would greatly appreciate your help.


I have created a menu in my android app. The problem I am having is, how do I select a Menu Item and go to a web page?

Here is the code I have.
From MainActivity.kt-----------------------------------------
override fun onOptionsItemSelected(item: MenuItem): Boolean {
       
        return when (item.itemId) {
            R.id.action_locate -> true
            else -> super.onOptionsItemSelected(item)
        }
        return when (item.itemId) {
            R.id.action_scanner -> true
            else -> super.onOptionsItemSelected(item)
        }
        return when (item.itemId) {
            R.id.action_qrcodescanner -> true
            else -> super.onOptionsItemSelected(item)
        }
        return when (item.itemId) {
            R.id.action_mainsite -> true
            else -> super.onOptionsItemSelected(item)
        }

------------------------------------------------------------

MenuMain.xml-------------------------------------------------
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.sdf.sdf.MainActivity">

<item
    android:id="@+id/action_locate"
    android:orderInCategory="100"
    android:title="Locate Vehicle"
    app:showAsAction="never" />
<item
    android:id="@+id/action_scanner"
    android:title="BarCode Scanner"
    android:orderInCategory="100"
    app:showAsAction="never" />
<item
    android:id="@+id/action_qrcodescanner"
    android:icon="@drawable/ic_scanner_black_24dp"
    android:orderInCategory="100"
    android:title="Q.R. Code Scanner"
    app:showAsAction="never" />
<item
    android:id="@+id/action_mainsite"
    android:icon="@android:drawable/checkbox_on_background"
    android:orderInCategory="100"
    android:title="TheSite.com"
    app:showAsAction="never" />
    
</menu>
---------------------------------------------

Please tell me if you need any other code.

I just want to know how to make a menu item go to a webpage.

Thank you.
SuggestionRe: onOptionsItemSelected go to a website Pin
David Crow10-Feb-20 17:39
MemberDavid Crow10-Feb-20 17:39 
QuestionHello, I am a newbie here, good to meet yah. Pin
The_Arcaniac1-Feb-20 23:14
MemberThe_Arcaniac1-Feb-20 23:14 
AnswerRe: Hello, I am a newbie here, good to meet yah. Pin
David Crow4-Feb-20 17:24
MemberDavid Crow4-Feb-20 17:24 
QuestionGlobalization issues with Dates Pin
Vimalsoft(Pty) Ltd29-Dec-19 11:17
professionalVimalsoft(Pty) Ltd29-Dec-19 11:17 
AnswerRe: Globalization issues with Dates Pin
Eddy Vluggen29-Dec-19 13:05
professionalEddy Vluggen29-Dec-19 13:05 
AnswerRe: Globalization issues with Dates Pin
Richard MacCutchan30-Dec-19 1:09
communityengineerRichard MacCutchan30-Dec-19 1:09 
GeneralRe: Globalization issues with Dates Pin
Vimalsoft(Pty) Ltd30-Dec-19 8:35
professionalVimalsoft(Pty) Ltd30-Dec-19 8:35 
SuggestionRe: Globalization issues with Dates Pin
Richard Deeming7-Jan-20 10:16
communityengineerRichard Deeming7-Jan-20 10:16 
QuestionFirebase infinite scroll list view Load 10 items on Scrolling using firebase realtime database "Android Project" Pin
lucas houmga19-Dec-19 23:47
Memberlucas houmga19-Dec-19 23:47 
QuestionHelp me with this simple app. Pin
All Matter25-Nov-19 9:02
MemberAll Matter25-Nov-19 9:02 
SuggestionRe: Help me with this simple app. Pin
David Crow30-Nov-19 5:33
MemberDavid Crow30-Nov-19 5:33 
QuestionUnmanaged library exception handling Pin
wakeup4425-Nov-19 0:01
Memberwakeup4425-Nov-19 0:01 
QuestionAre BroadcastReciever and ContentObserver killed If Started From Service? Pin
Django_Untaken27-Oct-19 20:15
MemberDjango_Untaken27-Oct-19 20:15 
AnswerRe: Are BroadcastReciever and ContentObserver killed If Started From Service? Pin
Richard MacCutchan27-Oct-19 23:21
communityengineerRichard MacCutchan27-Oct-19 23:21 
QuestionDo you believe that Kotlin will become more popular than Java? Pin
Darina Smartym15-Oct-19 23:28
MemberDarina Smartym15-Oct-19 23:28 
AnswerRe: Do you believe that Kotlin will become more popular than Java? Pin
Afzaal Ahmad Zeeshan28-Oct-19 2:02
mvaAfzaal Ahmad Zeeshan28-Oct-19 2:02 
GeneralRe: Do you believe that Kotlin will become more popular than Java? Pin
The_Arcaniac2-Feb-20 0:13
MemberThe_Arcaniac2-Feb-20 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.