If I don't import R, I get "id cannot be resolved or is not a field"
(R.id.mainanim);
And if I import R, the id error is gone, but I get "main and mainanim cannot be resolved or is not a field". They're my xml files! :0 Can you help me?
Also here is ALL my code... maybe there is an error I didn't see?
JAVA:
package com.example.carrottest2;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
import android.R;
public class Carrottest2 extends Activity {
/** Called when the activity is first created. */
AnimationDrawable mainanimation;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
ImageView mainimage = (ImageView) findViewById(R.id.mainanim);
mainimage.setBackgroundResource(R.anim.mainanim);
mainanimation = (AnimationDrawable) mainimage.getBackground();
Main.XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
Mainanim.xml:
<?xml version="1.0" encoding="UTF-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/carrotsmile" android:duration="2000" />
<item android:drawable="@drawable/carrotblink" android:duration="2000" />
</animation-list>
Please help. :(