Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Android Programming

    Im having a problem with my Android applet I am creating using a program called Eclipse

    It reads the error:
    'The method onCreateOptionsMenu(Menu) in the type Activity is not applicable for the arguments (Menu)'.


    Here is what I have written:

    [code] public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater awesome = getMenuInflater();
    awesome.inflate(R.menu.main_menu, menu);
    return true;
    } [code]

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,316
    Thanks
    203
    Thanked 2,566 Times in 2,544 Posts
    This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia!

    Ask a mod to move you over to the right forum.

    It is your responsibility to die() if necessary….. - PHP Manual

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,929
    Thanks
    46
    Thanked 203 Times in 202 Posts
    We will most likely need to see the Resources xml file as well- in addition the functions that are calling that- Also I think you will go into an infinite recursive loop there won't you?
    Code:
    public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    ....
    it seems as though it will just keep calling itself over and over and over and ... etc...
    as for the error message, debug and then see what datatype is being passed- if it is not a "menu" datatype then you need to convert it before calling...

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • Users who have thanked alykins for this post:

    Techfission (03-05-2012)

  • #4
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I think this is what is calling that and underneath is my xml programming

    [code]
    package com.edu4Java.adroid.tutorial1;

    import android.app.Activity;
    import android.os.Bundle;

    public class sweet extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);
    }

    }
    [code]


    and my xml file:

    [code] <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
    android:id="@+id/menuSweet"
    android:alphabeticShortcut="s"
    android:title="Open Sweet Activity"
    />
    <item
    android:id="@+id/menuToast"
    android:alphabeticShortcut="t"
    android:title="Open Toast"
    />
    </menu>[code]

  • #5
    New to the CF scene
    Join Date
    Feb 2012
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This is what I am trying to create thank you so much for your input so far thank you )

    http://www.youtube.com/watch?feature...&v=ceWhhyQt-MU


  •  

    LinkBacks (?)


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •