-
[android]2simple App
Anybody knows why this code won't compile?
Code:
package com.leebrainlow.tween;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button b = (Button) findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Animation anim = AnimationUtils.loadAnimation(Main.this, R.anim.animation);
b.startAnimation(anim);
}
});
}
}
-
Re: [android]2simple App
What is the compiler error message?
-
Re: [android]2simple App
-
Re: [android]2simple App
There's no visible class called OnClickListener.
I've not used Android at all but from the error messages it looks like it was expecting an object of type View.OnClickListener
-
Re: [android]2simple App
here are some options
pic
-
Re: [android]2simple App
Did you try changing the type to the correct one by appending the "View."?
-
Re: [android]2simple App
-
Re: [android]2simple App