In my code, I have two text boxes that validate input as the user types, and they either display a red cross or a green tick to the right of the box depending on whether the current input is valid or not. I had the red cross image stored in my drawable folder.
Everything was working fine until I decided to get rid of my splash screen. I deleted the class and XML layout file and changed the default activity to 'Login', the one with the tick/cross validation.
Now instead of showing a cross when there is incorrect input, a red square is shown. There are no error messages saying that the image can't be found, but I couldn't see it in the drawable folder, so I copied the image across again with the same name. I can now see the image in the folder after refreshing the project, but still the same thing happens.
I've tried restarting eclipse to no avail. Any ideas?
The android manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.crowded.media"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:targetSdkVersion="8"
android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".Login"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="RegisteredUser"></activity>
<activity android:name="OnePennyChallenge"></activity>
<activity android:name="GamesScreen"></activity>
<activity android:name="SafeCracker"></activity>
</application>
</manifest>
The code where I change the image:
// Add key listener to email edittext and validate as user enters data
email.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable s) {
String enteredEmail = email.getText().toString();
if (validateEmail(enteredEmail) == true) {
image1.setImageResource(R.drawable.greentick);
}
else {
image1.setImageResource(R.drawable.redcross);
}
}
Screen shot showing the res/drawable folder:
And the mysterious red box image: