From the sending Activity
String phonenum=mPlace.getPhoneNumber();
intent.putExtra("Phone Number: ", phonenum);
Uri Web = mPlace.getWebsiteUri();
intent.putExtra("Web: ", Web);
In the Receiving Activity my Code is as follows
Bundle bundle = getIntent().getExtras();
String phonenum = bundle.getString("Phone Number: ");
String Web = bundle.getString("Web: ");
TextView Txtview3 = (TextView) findViewById(R.id.telephone);
Txtview3.setText(phonenum);
TextView web = (TextView) findViewById(R.id.url7)
web.setText(Web);
正如我提到的那样,电话号码代码可以正常工作,但是我不知道URL代码缺少什么。我检查了一些答案,但没有找到解决方案。任何想法将不胜感激
答案 0 :(得分:0)
Uri类实现可拆分接口,因此您应该:
在父活动中:
Intent intent = new Intent(this, SecondActivity.class);
Uri uri = mPlace.getWebsiteUri();
intent.putExtra("web_uri_identifier", uri);
startActivity(intent);
在目标活动中:
Uri uri = getIntent().getExtras().getParcelable("web_uri_identifier");
请记住以小写字母开头变量名,以便区分变量与类