<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to create an option menu</title>
	<atom:link href="http://www.droidnova.com/how-to-create-an-option-menu,427.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html</link>
	<description>Rapid android development from Berlin</description>
	<lastBuildDate>Thu, 09 Sep 2010 14:31:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Ganapathy</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1344</link>
		<dc:creator>Ganapathy</dc:creator>
		<pubDate>Wed, 01 Sep 2010 11:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1344</guid>
		<description>hi,
i get error in menu.xml file but i copy the same thing in site...

when i try to run the project you given it&#039;s working.</description>
		<content:encoded><![CDATA[<p>hi,<br />
i get error in menu.xml file but i copy the same thing in site&#8230;</p>
<p>when i try to run the project you given it&#8217;s working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucy</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1334</link>
		<dc:creator>Lucy</dc:creator>
		<pubDate>Sat, 28 Aug 2010 17:52:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1334</guid>
		<description>Hi, Thanks for the tutorial, could you help me a little further with the menu, i would like to open a url link once one of the menu buttons have been clicked.

Please could you show what code i should use to make this happen.

Many thanksyou&#039;s
Lucy</description>
		<content:encoded><![CDATA[<p>Hi, Thanks for the tutorial, could you help me a little further with the menu, i would like to open a url link once one of the menu buttons have been clicked.</p>
<p>Please could you show what code i should use to make this happen.</p>
<p>Many thanksyou&#8217;s<br />
Lucy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Q</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1296</link>
		<dc:creator>Q</dc:creator>
		<pubDate>Tue, 10 Aug 2010 14:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1296</guid>
		<description>Tutorial also at http://developer.android.com/guide/topics/ui/menus.html</description>
		<content:encoded><![CDATA[<p>Tutorial also at <a href="http://developer.android.com/guide/topics/ui/menus.html" rel="nofollow">http://developer.android.com/guide/topics/ui/menus.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robbe</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1295</link>
		<dc:creator>Robbe</dc:creator>
		<pubDate>Mon, 09 Aug 2010 20:43:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1295</guid>
		<description>Wicked awesome - works like a champ!

Thanks and will keep an eye out for new Android wisdom you have to offer.

/r</description>
		<content:encoded><![CDATA[<p>Wicked awesome &#8211; works like a champ!</p>
<p>Thanks and will keep an eye out for new Android wisdom you have to offer.</p>
<p>/r</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lincoln</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1274</link>
		<dc:creator>Lincoln</dc:creator>
		<pubDate>Wed, 28 Jul 2010 13:28:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1274</guid>
		<description>hi, I&#039;ve tried your tutorial &amp; it works. But when I tried to incorporate it with my application, the option menu just wouldn&#039;t appear no matter how many times I tap on the menu button.</description>
		<content:encoded><![CDATA[<p>hi, I&#8217;ve tried your tutorial &amp; it works. But when I tried to incorporate it with my application, the option menu just wouldn&#8217;t appear no matter how many times I tap on the menu button.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bindushreebs</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1219</link>
		<dc:creator>bindushreebs</dc:creator>
		<pubDate>Fri, 09 Jul 2010 05:47:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1219</guid>
		<description>hi,
  thanks a lot for ur blog it really helped me a lot .</description>
		<content:encoded><![CDATA[<p>hi,<br />
  thanks a lot for ur blog it really helped me a lot .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: varun</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1179</link>
		<dc:creator>varun</dc:creator>
		<pubDate>Fri, 25 Jun 2010 18:55:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1179</guid>
		<description>Hi,
This may be rather long comment but I am trying to learn Android and I am also new to Java. I tried incorporating your tutorial in this notepad tutorial which is available on Android website but I find it confusing to understand how we can keep what the existing on create options menu is doing and incorporate the menu items as your are teaching in this tutorial. Please help. 
&lt;pre lang=&quot;java&quot; line=&quot;1&quot;&gt;
/*
 * Copyright (C) 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.demo.notepad1;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.SimpleCursorAdapter;

public class Notepadv1 extends ListActivity {
    private int mNoteNumber = 1;
    private NotesDbAdapter mDbHelper;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.notepad_list);
        mDbHelper = new NotesDbAdapter(this);
        mDbHelper.open();
        fillData();
    }
    private void fillData() {
        // Get all of the notes from the database and create the item list
        Cursor c = mDbHelper.fetchAllNotes();
        startManagingCursor(c);

        String[] from = new String[] { NotesDbAdapter.KEY_TITLE };
        int[] to = new int[] { R.id.text1 };
        
        // Now create an array adapter and set it to display using our row
        SimpleCursorAdapter notes =
            new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
        setListAdapter(notes);
    }
    public static final int INSERT_ID = Menu.FIRST;
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean result = super.onCreateOptionsMenu(menu);
        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
        return result;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
        case INSERT_ID:
            createNote();
            return true;
        }
       
        return super.onOptionsItemSelected(item);
    }
    private void createNote() {
        String noteName = &quot;Note &quot; + mNoteNumber++;
        mDbHelper.createNote(noteName, &quot;&quot;);
        fillData();
    }
}&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi,<br />
This may be rather long comment but I am trying to learn Android and I am also new to Java. I tried incorporating your tutorial in this notepad tutorial which is available on Android website but I find it confusing to understand how we can keep what the existing on create options menu is doing and incorporate the menu items as your are teaching in this tutorial. Please help.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * Copyright (C) 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.android.demo.notepad1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.ListActivity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.database.Cursor</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.Menu</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.MenuItem</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.SimpleCursorAdapter</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Notepadv1 <span style="color: #000000; font-weight: bold;">extends</span> ListActivity <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> mNoteNumber <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> NotesDbAdapter mDbHelper<span style="color: #339933;">;</span>
    <span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">notepad_list</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mDbHelper <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NotesDbAdapter<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        mDbHelper.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fillData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> fillData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Get all of the notes from the database and create the item list</span>
        <span style="color: #003399;">Cursor</span> c <span style="color: #339933;">=</span> mDbHelper.<span style="color: #006633;">fetchAllNotes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        startManagingCursor<span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> from <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> NotesDbAdapter.<span style="color: #006633;">KEY_TITLE</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> to <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> R.<span style="color: #006633;">id</span>.<span style="color: #006633;">text1</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Now create an array adapter and set it to display using our row</span>
        SimpleCursorAdapter notes <span style="color: #339933;">=</span>
            <span style="color: #000000; font-weight: bold;">new</span> SimpleCursorAdapter<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">notes_row</span>, c, from, to<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        setListAdapter<span style="color: #009900;">&#40;</span>notes<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000066; font-weight: bold;">int</span> INSERT_ID <span style="color: #339933;">=</span> <span style="color: #003399;">Menu</span>.<span style="color: #006633;">FIRST</span><span style="color: #339933;">;</span>
    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onCreateOptionsMenu<span style="color: #009900;">&#40;</span><span style="color: #003399;">Menu</span> menu<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">boolean</span> result <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreateOptionsMenu</span><span style="color: #009900;">&#40;</span>menu<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        menu.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, INSERT_ID, <span style="color: #cc66cc;">0</span>, R.<span style="color: #006633;">string</span>.<span style="color: #006633;">menu_insert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> result<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> onOptionsItemSelected<span style="color: #009900;">&#40;</span><span style="color: #003399;">MenuItem</span> item<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>item.<span style="color: #006633;">getItemId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">case</span> INSERT_ID<span style="color: #339933;">:</span>
            createNote<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onOptionsItemSelected</span><span style="color: #009900;">&#40;</span>item<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> createNote<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003399;">String</span> noteName <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Note &quot;</span> <span style="color: #339933;">+</span> mNoteNumber<span style="color: #339933;">++;</span>
        mDbHelper.<span style="color: #006633;">createNote</span><span style="color: #009900;">&#40;</span>noteName, <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fillData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1169</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Sun, 20 Jun 2010 08:16:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1169</guid>
		<description>What did you do exactly? You added one more item to the xml and it stopped working? Please be a bit more specific.</description>
		<content:encoded><![CDATA[<p>What did you do exactly? You added one more item to the xml and it stopped working? Please be a bit more specific.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tifoso</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1168</link>
		<dc:creator>tifoso</dc:creator>
		<pubDate>Sat, 19 Jun 2010 19:51:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1168</guid>
		<description>I added one more menu and the whole thing went kaputt. Is there way to get around that path issue addind/deleting a library to solve it looks like clunky MS</description>
		<content:encoded><![CDATA[<p>I added one more menu and the whole thing went kaputt. Is there way to get around that path issue addind/deleting a library to solve it looks like clunky MS</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mustafa</title>
		<link>http://www.droidnova.com/how-to-create-an-option-menu,427.html/comment-page-1#comment-1163</link>
		<dc:creator>Mustafa</dc:creator>
		<pubDate>Thu, 17 Jun 2010 14:41:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.droidnova.com/?p=427#comment-1163</guid>
		<description>Excellent Tutorial! Really loving this site. Has taught me so much. Thanks you guys :)</description>
		<content:encoded><![CDATA[<p>Excellent Tutorial! Really loving this site. Has taught me so much. Thanks you guys <img src='http://www.droidnova.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->