...

View Full Version : Android Programming



Techfission
02-26-2012, 01:25 PM
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]

Philip M
02-26-2012, 02:07 PM
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

alykins
02-26-2012, 11:54 PM
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?


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...

Techfission
03-05-2012, 11:46 AM
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]

Techfission
03-05-2012, 12:29 PM
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=fvwp&NR=1&v=ceWhhyQt-MU



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum