Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R.id Cannot be resolved

I guess something should be done with the Android-Manifest.xml file or something in the layout folder. I am new to Android so I don't know what I should write.

public class AndroidPong extends Activity implements  OnClickListener {
    static String tag;

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

        tag = getResources().getString(R.string.app_name);
        fullScreen();
        splashScreen();
    }

    @Override
    protected Dialog onCreateDialog(int id) {
        // TODO Auto-generated method stub
        return super .onCreateDialog(id);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // TODO Auto-generated method stub
        return super .onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // TODO Auto-generated method stub
        return super .onOptionsItemSelected(item);
    }

    @Override
    protected void onStop() {
        // TODO Auto-generated method stub
        super .onStop();
    }

    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super .onDestroy();
    }

    void startGame() {
        setContentView(R.layout.game);// error
        this .findViewById(R.id.Button01).setOnClickListener(this );//error
        this .findViewById(R.id.Button02).setOnClickListener(this );//Error
    }

    void splashScreen() {
        setContentView(R.layout.splash);// error
        this .findViewById(R.id.pongtable).setOnClickListener(this );//error
    }

    void gameMenu() {

    }

    void fullScreen() {
        this .requestWindowFeature(Window.FEATURE_NO_TITLE);
        this .getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    public static void debug(String debug) {
        Log.d(tag, debug);
    }


<?xml version="1.0" encoding="utf-8"?>
<absoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent">

<Button android:id="@+id/Button01"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"

<Button android:id="+id/Button02"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
 </absoluteLayout>
like image 607
GameBuilder Avatar asked Jan 19 '23 14:01

GameBuilder


1 Answers

If you are using eclipse, this question has already been asked

R cannot be resolved - Android error

like image 82
Scott Avatar answered Feb 08 '23 05:02

Scott