0

I am developing an android application with eclipse and cannot seem to solve these errors which are cropping up. I am new to developing and your help would be greatly appreciated. Thank you

My errors are here http://oi50.tinypic.com/2hflzc8.jpg

Here's my code:

package com.example.easyfindme; import com.example.easyfindme.R; import android.app.Activity; import android.os.Bundle; import android.view.Menu; public class EasyFindMe extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(android.R.layout.activity_easy_find_me); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(android.R.menu.activity_easy_find_me, menu); return true; } 

}

1
  • android.R refer to system resource in the OS. If you want to reference your own resource use <your package>.R (com.example.easyfindme.R). Commented Jul 23, 2012 at 11:30

4 Answers 4

2

use

setContentView(R.layout.activity_easy_find_me); 

instead of

setContentView(android.R.layout.activity_easy_find_me); 
Sign up to request clarification or add additional context in comments.

Comments

0

You should include your R.java file, not android.R ..

setContentView(android.R.layout.activity_easy_find_me); //is wrong setContentView(com.example.easyfindme.R.layout.activity_easy_find_me); //is right 

Comments

0

//dont use

android.R.layout.activity_easy_find_me 

use as

R.layout.activity_easy_find_me 

// for menu you need seperate xml in menu folder. layout xml wont work.

getMenuInflater().inflate(R.menu.menuxml, menu); 

Comments

0

Change your code to the following code

 public class EasyFindMe extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_easy_find_me);<========== here } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_easy_find_me, menu);<======== here return true; } } 

It's a problem with using android.R.xxxx in your layout. that's the problem.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.