ace_hkt
ace_hkt

Reputation: 1

Switching two activities

I am new to Android apps development. I have a question on switching two activities. I followed a youtube for switching two activities: http://www.youtube.com/watch?v=0wz0bM-xy3M

But when I enter those code as shown in the bottom for my next class NextActivity.java,

I noticed that I have three mistakes.......

  1. protected void onCreate(Bundle savedInstanceState) - The method onCreate(Bundle) of type NextActivity must override or implement a supertype method
  2. super.onCreate(savedInstanceState)-The method onCreate() in the type Application is not applicable for the arguments (Bundle)
  3. setContentView(R.layout.next) - The method setContentView(int) is undefined for the type NextActivity

What's mistakes do I make? Thanks a lot!

package gorilla3d.activitytutorial;


import android.app.Application;
import android.os.Bundle;


public class NextActivity extends Application {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.next);
    }

}

Upvotes: 0

Views: 61

Answers (1)

dors
dors

Reputation: 5872

You need to extend Activity instead of Application

...
public class NextActivity extends Activity {
...

Upvotes: 2

Related Questions