I am trying to follow a simple splash screen example I found. But I cannot get it to even compile.
First this is the source of the example here.
I am trying to put in into a form that would work for my program.
I created a class in Eclipse for this splash screen
com.ePN.ePNMobileAndroid.ePNSplash
Here is my current main.xml file.
<?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">
<ImageView android:id="@+id/splashscreen" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:src="@drawable/com.ePN.ePNMobileAndroid.splash"
android:layout_gravity="center"/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Hello World, splash"/>
</LinearLayout>
And the class itself
package com.ePN.ePNMobileAndroid;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.ImageView;
public class ePNSplash extends Activity {
private static final int STOPSPLASH = 0;
//time in milliseconds
private static final long SPLASHTIME = 3000;
private ImageView splash;
//handler for splash screen
private Handler splashHandler = new Handler() {
/* (non-Javadoc)
* @see android.os.Handler#handleMessage(android.os.Message)
*/
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
//remove SplashScreen from view
splash.setVisibility(View.GONE);
break;
}
super.handleMessage(msg);
}
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
splash = (ImageView) findViewById(R.id.splashscreen);
Message msg = new Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(msg, SPLASHTIME);
}
}
XML error:
no resource found that matches the given name (at src with value @drawable/com.ePN.ePNMobileAndroid.splash )
I have tried every way I can think to modify the android:src
but it will not work.
The class is in error because it cannot resolve r_id.splashscreen
in the find by id line.
This is all greek to me, how should this trivial xml and/or java file be modified to make this work?