Click here to Skip to main content
14,663,843 members
Home » Discussions » Android
   

Android

 
QuestionAndroid - Running endless code in Foreground while using the app Pin
Exoskeletor12-Mar-20 22:50
MemberExoskeletor12-Mar-20 22:50 
AnswerOFFTOPIC Pin
Nelek17-Mar-20 2:18
protectorNelek17-Mar-20 2:18 
QuestionUnfortunately app has stopped Pin
Kevsh25-Feb-20 7:29
MemberKevsh25-Feb-20 7:29 
AnswerRe: Unfortunately app has stopped Pin
Richard MacCutchan25-Feb-20 8:22
mveRichard MacCutchan25-Feb-20 8:22 
AnswerRe: Unfortunately app has stopped Pin
Exoskeletor12-Mar-20 22:53
MemberExoskeletor12-Mar-20 22:53 
QuestionConversion file backup .csv to file backup Crypt5 or Crypt12 Pin
Oderisio13-Feb-20 5:46
MemberOderisio13-Feb-20 5:46 
Rant[REPOST] Conversion file backup .csv to file backup Crypt5 or Crypt12 Pin
Richard Deeming13-Feb-20 6:46
mveRichard Deeming13-Feb-20 6:46 
QuestiononOptionsItemSelected go to a website Pin
The_Arcaniac1-Feb-20 22:30
MemberThe_Arcaniac1-Feb-20 22: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 16:39
MemberDavid Crow10-Feb-20 16:39 
QuestionHello, I am a newbie here, good to meet yah. Pin
The_Arcaniac1-Feb-20 22:14
MemberThe_Arcaniac1-Feb-20 22:14 
AnswerRe: Hello, I am a newbie here, good to meet yah. Pin
David Crow4-Feb-20 16:24
MemberDavid Crow4-Feb-20 16:24 
AnswerRe: Hello, I am a newbie here, good to meet yah. Pin
Exoskeletor12-Mar-20 22:54
MemberExoskeletor12-Mar-20 22:54 
AnswerRe: Hello, I am a newbie here, good to meet yah. Pin
Seechon Boontharikwong10-Apr-20 6:26
MemberSeechon Boontharikwong10-Apr-20 6:26 
QuestionGlobalization issues with Dates Pin
Vimalsoft(Pty) Ltd29-Dec-19 10:17
professionalVimalsoft(Pty) Ltd29-Dec-19 10:17 
AnswerRe: Globalization issues with Dates Pin
Eddy Vluggen29-Dec-19 12:05
professionalEddy Vluggen29-Dec-19 12:05 
AnswerRe: Globalization issues with Dates Pin
Richard MacCutchan30-Dec-19 0:09
mveRichard MacCutchan30-Dec-19 0:09 
GeneralRe: Globalization issues with Dates Pin
Vimalsoft(Pty) Ltd30-Dec-19 7:35
professionalVimalsoft(Pty) Ltd30-Dec-19 7:35 
SuggestionRe: Globalization issues with Dates Pin
Richard Deeming7-Jan-20 9:16
mveRichard Deeming7-Jan-20 9:16 
GeneralRe: Globalization issues with Dates Pin
Exoskeletor12-Mar-20 22:58
MemberExoskeletor12-Mar-20 22:58 
QuestionFirebase infinite scroll list view Load 10 items on Scrolling using firebase realtime database "Android Project" Pin
lucas houmga19-Dec-19 22:47
Memberlucas houmga19-Dec-19 22:47 
AnswerRe: Firebase infinite scroll list view Load 10 items on Scrolling using firebase realtime database "Android Project" Pin
Exoskeletor13-Mar-20 1:58
MemberExoskeletor13-Mar-20 1:58 
QuestionHelp me with this simple app. Pin
All Matter25-Nov-19 8:02
MemberAll Matter25-Nov-19 8:02 
SuggestionRe: Help me with this simple app. Pin
David Crow30-Nov-19 4:33
MemberDavid Crow30-Nov-19 4:33 
AnswerRe: Help me with this simple app. Pin
Exoskeletor13-Mar-20 2:09
MemberExoskeletor13-Mar-20 2:09 
QuestionUnmanaged library exception handling Pin
wakeup4424-Nov-19 23:01
Memberwakeup4424-Nov-19 23:01 

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.