gpt4 book ai didi

android - 将字符串和 Latlng 从一个 Activity 发送到另一个 Activity 时出错

转载 作者:行者123 更新时间:2023-11-30 03:18:40 24 4
gpt4 key购买 nike

我想要从一个 Activity 到另一个 Activity 的一些变量,但我的应用程序崩溃了我的日志:

10-24 17:31:05.765 E/AndroidRuntime(16529): FATAL EXCEPTION: main10-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 #0x010-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 #0x010-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

这是我的代码

  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;

最佳答案

您必须将经纬度设置为 TextView ...请将您的经纬度转换为字符串,然后将其设置为 TextView ,如下所示;

yourtextview.setText(latlng+"");

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

希望对您有所帮助。

关于android - 将字符串和 Latlng 从一个 Activity 发送到另一个 Activity 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19565981/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com