Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Basic Andriod Menu Code help to open URL link

Basic Andriod Menu Code help to open URL link

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Basic Andriod Menu Code help to open URL link

Postby lucy » Sat Aug 28, 2010 8:58 pm

Hi,
Could anyone help me with some basic android code, i have followed a tutorial to display a menu once the menu button on the phone is pressed.

I just dont know how to add an action to the menu button to do something, i would like them to open a url link in the phone browser.

Hope some one can help

menu.xml code below

Code: Select all
<menu

xmlns:android="http://schemas.android.com/apk/res/android">
   <item android:id="@+id/text1"
        android:title="Text" />
    <item android:id="@+id/text2"
        android:title="Text" />
    <item android:id="@+id/text3"
        android:title="Text"  />
</menu>


Java code below

Code: Select all
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.text1:     Toast.makeText(this, "You pressed

the icon!", Toast.LENGTH_LONG).show();
                            break;
        case R.id.text2:     Toast.makeText(this, "You pressed

the icon!", Toast.LENGTH_LONG).show();
        break;
        case R.id.text3:     Toast.makeText(this, "You pressed

the icon!", Toast.LENGTH_LONG).show();
        break;
    }
    return true;
}

}
lucy
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 20, 2010 2:59 pm

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests