|
-
May 14th, 2012, 01:56 PM
#1
[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);
}
});
}
}
-
May 15th, 2012, 02:07 AM
#2
Re: [android]2simple App
What is the compiler error message?
-
May 15th, 2012, 03:50 AM
#3
-
May 15th, 2012, 04:20 AM
#4
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
-
May 15th, 2012, 05:10 AM
#5
Re: [android]2simple App
here are some options
pic
-
May 15th, 2012, 01:28 PM
#6
Re: [android]2simple App
Did you try changing the type to the correct one by appending the "View."?
-
May 16th, 2012, 01:19 PM
#7
-
May 16th, 2012, 01:27 PM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|