I'm very new to android and am stuck with something very simple. I'm trying to state that for a variable x (can be a, b or c), there is a corresponding integer value (i.e. 0, 1 and 2)
String mpee = x;
int mpef = 0;
int mpev = 0;
if (mpee == "a") { mpef = mpev + 0; }
if (mpee == "b") { mpef = mpev + 1; }
if (mpee == "c") { mpef = mpev + 2; }
int mpp = mpef;
The output will be int mpp. There is no problem with the code as far as Eclipse is concerned, but when I run it, the application hangs. The following is the logcat.
06-05 13:29:49.014: E/AndroidRuntime(1608): FATAL EXCEPTION: main
06-05 13:29:49.014: E/AndroidRuntime(1608): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.exa.huy/com.example.exa.huy}: android.content.res.Resources$NotFoundException:
String resource ID #0x0
06-05 13:29:49.014: E/AndroidRuntime(1608): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
06-05 13:29:49.014: E/AndroidRuntime(1608): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
06-05 13:29:49.014: E/AndroidRuntime(1608): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
06-05 13:29:49.014: E/AndroidRuntime(1608): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
06-05 13:29:49.014: E/AndroidRuntime(1608): at
android.os.Handler.dispatchMessage(Handler.java:99)
06-05 13:29:49.014: E/AndroidRuntime(1608): at android.os.Looper.loop(Looper.java:137)
What did I do wrong?