I have two pages in my application, I am passing one certain value from one page to another:
Class Level Definition: (From the sending class)
BuyGold50 BG5 = null;
In onCreate() of the same class:
BG5 = new BuyGold50();
In a certain function of the first activity--Before calling intent to second Activity
BG5.SetPrice(Gold);
================================================================================
Code of the BuyGold50 class
public class BuyGold50 extends Activity {
public static String B;
static int X;
public void SetPrice(String Price) {
B = Price;
X = Integer.parseInt(B);
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.buy_gold50);
TextView tv = (TextView) findViewById(R.id.textView1);
tv.setText(X);
}
}
Log Cat
07-30 11:59:07.304: E/AndroidRuntime(615): FATAL EXCEPTION: main
07-30 11:59:07.304: E/AndroidRuntime(615): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Geet/com.Geet.BuyGold50}: android.content.res.Resources$NotFoundException: String resource ID #0xb34
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.os.Handler.dispatchMessage(Handler.java:99)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.os.Looper.loop(Looper.java:123)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-30 11:59:07.304: E/AndroidRuntime(615): at java.lang.reflect.Method.invokeNative(Native Method)
07-30 11:59:07.304: E/AndroidRuntime(615): at java.lang.reflect.Method.invoke(Method.java:507)
07-30 11:59:07.304: E/AndroidRuntime(615): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-30 11:59:07.304: E/AndroidRuntime(615): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-30 11:59:07.304: E/AndroidRuntime(615): at dalvik.system.NativeStart.main(Native Method)
07-30 11:59:07.304: E/AndroidRuntime(615): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xb34
07-30 11:59:07.304: E/AndroidRuntime(615): at android.content.res.Resources.getText(Resources.java:201)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.widget.TextView.setText(TextView.java:2857)
07-30 11:59:07.304: E/AndroidRuntime(615): at com.Geet.BuyGold50.onCreate(BuyGold50.java:21)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-30 11:59:07.304: E/AndroidRuntime(615): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-30 11:59:07.304: E/AndroidRuntime(615): ... 11 more