I keep getting an error saying my xml file cannot be resolved to a field. I found answers saying to delete the import R statement which I have done, but this just brings up another error saying R cannot be resolved to a variable. It seems like I am doomed whether or not I use the import statement. Any advice?
Here's the code
public class VirtualGallery extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler x = new Handler();
x.postDelayed(new SplashHandler(), 5000);
}
class SplashHandler implements Runnable{
public void run(){
Intent myIntent = new Intent(VirtualGallery.this, Main.class);
startActivity(myIntent);
}
}
}
here's the splash xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#393131" >
<ImageView
android:id="@+id/museum_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/museum_logo" />
</RelativeLayout>
Make sure you have imported
your.package.R
notandroid.R
. Then look for error(s) in yourres
directory. It seems that somewhere in yourres
directory you have an error that prevents regeneratingR
class. Solve that error andclean
your project.