亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Uri.parse() 在給定的 Url 之前添加 null

Uri.parse() 在給定的 Url 之前添加 null

米脂 2023-04-19 17:05:08
我正在傳遞一個 Google 地圖 Url 以使用地圖應用程序啟動搜索,并且一切正常。在我的 linux 機器上導入我的項目后,mapIntent.resolveActivity()盡管null設備有谷歌地圖并且gmINtentUri是nullhttps://www.google.com/maps/search/?api=1&query=Spilia%20Beach. 我猜這是由于nullUrl 前面的額外部分引起的。是什么原因造成的?它沒有發生在我的 Windows 機器上。編輯:我發現字符串開頭的gmIntentUri's值是由于這個原因造成的。我稍后會提交答案。nullparcel.writeString(finalMapSearchUrl);@OnClick(R.id.show_in_map_button) void openMap() {    Uri gmIntentUri = Uri.parse(placeObject.getMapSearchUrl()); // Create a Uri from a string. Use the result to create an Intent    Intent mapIntent = new Intent(Intent.ACTION_VIEW,gmIntentUri);    // Make the Intent explicit by settings the Google Maps package    mapIntent.setPackage("com.google.android.apps.maps");    // Verify that there is an app available to receive the intent    if(mapIntent.resolveActivity(getPackageManager()) != null) {        startActivity(mapIntent); // if the result is non-null there is at least one app that can handle the intent    } else {        Log.d(TAG,"Error resolving Activity for map Intent in openMap(), [Uri = " + gmIntentUri + "].");        Log.d(TAG,"mapIntent.resolveActivity() = " + mapIntent.resolveActivity(getPackageManager()));    }}
查看完整描述

1 回答

?
慕后森

TA貢獻1802條經驗 獲得超5個贊

我想通了 的gmIntentUri開頭的空值string是由于這個parcel.writeString(finalMapSearchUrl);



查看完整回答
反對 回復 2023-04-19
  • 1 回答
  • 0 關注
  • 169 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號