简体   繁体   中英

R.java Error when adding new layouts

// Activity1.java

setContentView(R.layout.activity1);

// AndroidManifest.xml

    <activity android:name=".Activity3"
          android:label="@string/page2">
    </activity>

These are the lines that show an error.

I am trying to use Intent and move from page 1->2->3

this the button code

Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new View.OnClickListener() {
    public void onClick(View arg0) {
    Intent i = new Intent(Activity1.this,Activity2.class);
    startActivity(i);
    }
 });

Add these 2 lines too within application tags in your manifest.xml file

  <application>
  .....

 <activity android:name=".Activity2" />
 <activity android:name=".Activity3" />

 ....

 </application>

Add Ur activity names (2 activites) to manifest file. and here i have taken like

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM