1
votes

I want to some variables from one activity to another but my application got crashed My log:

10-24 17:31:05.765 E/AndroidRuntime(16529): FATAL EXCEPTION: main
10-24 17:31:05.765 E/AndroidRuntime(16529): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.restaurantfinder/com.example.restaurantfinder.RestaurantInfo}: android.content.res.Resources$NotFoundException: String resource ID #0x0
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.ActivityThread.access$600(ActivityThread.java:128)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.os.Looper.loop(Looper.java:137)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.ActivityThread.main(ActivityThread.java:4517)
10-24 17:31:05.765 E/AndroidRuntime(16529): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 17:31:05.765 E/AndroidRuntime(16529): at java.lang.reflect.Method.invoke(Method.java:511)
10-24 17:31:05.765 E/AndroidRuntime(16529): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
10-24 17:31:05.765 E/AndroidRuntime(16529): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
10-24 17:31:05.765 E/AndroidRuntime(16529): at dalvik.system.NativeStart.main(Native Method)
10-24 17:31:05.765 E/AndroidRuntime(16529): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.content.res.Resources.getText(Resources.java:260)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.widget.TextView.setText(TextView.java:3680)
10-24 17:31:05.765 E/AndroidRuntime(16529): at com.example.restaurantfinder.RestaurantInfo.onCreate(RestaurantInfo.java:49)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.Activity.performCreate(Activity.java:4470)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
10-24 17:31:05.765 E/AndroidRuntime(16529): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
10-24 17:31:05.765 E/AndroidRuntime(16529): ... 11 more

and this is my code

  view.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent intent=new Intent(context,RestaurantInfo.class);
                intent.putExtra("name", restaurantDetailList.get(position).getRestaurantName());
                Bundle args=new Bundle();
                args.putParcelable("geopiont", restaurantDetailList.get(position).getGeoPiont());
                intent.putExtra("bundle", args);
                intent.putExtra("address", restaurantDetailList.get(position).getAddress());
                intent.putExtra("type", restaurantDetailList.get(position).getType());
                intent.putExtra("flag",(restaurantDetailList.get(position).getFlag()));
                context.startActivity(intent);

                }
        });
        return view;
1
Put the line RestaurantInfo.java:49Alexis C.
Can you post the code where you want to get the extras form the intent in your started activity? May you are trying to "get" the wrong key.Tim

1 Answers

1
votes

you must be setting lat long to a textview...Please Convert your latlng to String and then after set it to textview as like below;

yourtextview.setText(latlng+"");

or

yourtextview.setText(String.ValueOf(latlng));

Hope it will help.