I am attempting to build my first app using the tutorial provided by android in Eclipse.
I've done everything is says but i get the error message..."menu cannot be resolved or is not a field". The tutorial doesn't mention anything about a menu and i'm sure i haven't done anything to it. The line it is complaining about i've marked in a comment.
package com.example.my.first.app;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu); <!--this line-->
return true;
}
}
This is the main activity page the tutorial has asked me to edit is shown below...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<EditText android:id="@+id/edit_message"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send" />
</LinearLayout>
Going off advice i've found on other questions i've attempted clicking on it and to include what ever it's asking for which is "Create field 'menu' in type 'R' or "Create constant 'menu' in type 'R'. I've done both separately and every time i save the project so it rebuilds, it automatically deletes the line that was included.
For the field, this was done. - public static Object menu; For the constant, this was done. - public static final String menu = null;
So i'm now a little stuck and would like some much needed help please.