Possible en double:
R cannot be resolved - Android erroréclipse ne reconnaît pas id ou fichier
Les erreurs que j'ai sont en ligne 18 et 19. Il ne reconnaît pas l'id IV1 mais id est dans mon fichier main.xml Ne reconnaît pas non plus logo_animation qui est un fichier xml et est orthographié correctement. Quelqu'un sait pourquoi c'est?
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);
}
}
Duplicate [http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error][1] [1]: http://stackoverflow.com/ questions/885009/r-impossible de résoudre le problème-android-error – Caner