Possible Duplicate:
R cannot be resolved - Android error
The errors I have are on line 18 and 19. It does not recognize the id iv1 but that id is in my main.xml file. Also does not recognize the logo_animation which is an xml file and is spelled correctly. Anyone know why this is?
package graphics.examples;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.graphics.drawable.AnimationDrawable;
public class graphics extends Activity {
AnimationDrawable logoAnimation;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView logoImage = (ImageView) findViewById(R.id.iv1);
logoImage.setBackgroundResource(R.drawable.logo_animation);
logoAnimation = (AnimationDrawable) logoImage.getBackground();
}
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN){
logoAnimation.start();
return true;
}
else return super.onTouchEvent(event);
}
}