简体   繁体   English

接收到的Intent数据与Android中发送的Intent数据不同

[英]Received Intent data different from sent intent data in Android

Kind of stumped on this one. 有点为难。 The intent data that I sent is correct (I used logging to view it), however, when I get the intent, it has completely different values. 我发送的意图数据是正确的(我使用日志记录来查看它),但是,当我得到意图时,它具有完全不同的值。

Why/how is this happening? 为什么/如何发生?

Sending Intent: 发送意向:

Intent viewUser = new Intent(ActivitiyMap.this, viewUser.class);
            viewUser.putExtra("latitude", String.valueOf(markerLat));
            viewUser.putExtra("longitude", String.valueOf(markerLong));
            viewUser.putExtra("userName", marker.getTitle());
            Log.d("userName", marker.getTitle());
            startActivity(viewUser); 

Recieving Intent: 接收意图:

 Intent intent = getIntent();
            userName = intent.getStringExtra("userName");
            userLat = intent.getStringExtra("latitude");
            userLong = intent.getStringExtra("longitude");

EDIT: Updated to use the right intent "viewUser". 编辑:更新为使用正确的意图“ viewUser”。 However still not passing the right information. 但是仍然没有传递正确的信息。

Your problem is that you never actually use the intent you create. 您的问题是您实际上从未使用过创建的意图。

You called it viewUser , but when you call startActivity you pass viewTheCameraImage instead. 您将其称为viewUser ,但是当您调用startActivity您传递的是viewTheCameraImage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM