androiduri
㈠ android中Uri.parse()用法是什麼
- 調web瀏覽器 
 Uri myBlogUri = Uri.parse("http://xxxxx.com");
 returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
- 地圖 - Uri mapUri = Uri.parse("geo:38.899533,-77.036476"); 
 returnIt = new Intent(Intent.ACTION_VIEW, mapUri);
- 調撥打電話界面 
 Uri telUri = Uri.parse("tel:100861");
 returnIt = new Intent(Intent.ACTION_DIAL, telUri);
- 直接撥打電話 
 Uri callUri = Uri.parse("tel:100861");
 returnIt = new Intent(Intent.ACTION_CALL, callUri);
- 卸載 
 Uri uninstallUri = Uri.fromParts("package", "xxx", null);
 returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);
- 安裝 
 Uri installUri = Uri.fromParts("package", "xxx", null);
 returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);
- 播放 
 Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
 returnIt = new Intent(Intent.ACTION_VIEW, playUri);
- 調用發郵件 
 Uri emailUri = Uri.parse("mailto:[email protected]");
 returnIt = new Intent(Intent.ACTION_SENDTO, emailUri);
- 發郵件 
 returnIt = new Intent(Intent.ACTION_SEND);- String[] tos = { "[email protected]" }; - String[] ccs = { "[email protected]" }; - returnIt.putExtra(Intent.EXTRA_EMAIL, tos); - returnIt.putExtra(Intent.EXTRA_CC, ccs); - returnIt.putExtra(Intent.EXTRA_TEXT, "body"); - returnIt.putExtra(Intent.EXTRA_SUBJECT, "subject"); - returnIt.setType("message/rfc882"); - Intent.createChooser(returnIt, "Choose Email Client"); 
- 發簡訊 - Uri smsUri = Uri.parse("tel:100861"); - returnIt = new Intent(Intent.ACTION_VIEW, smsUri); - returnIt.putExtra("sms_body", "yyyy"); - returnIt.setType("vnd.android-dir/mms-sms") 
- 直接發郵件 - Uri smsToUri = Uri.parse("smsto://100861"); - returnIt = new Intent(Intent.ACTION_SENDTO, smsToUri); - returnIt.putExtra("sms_body", "yyyy"); 
- 發彩信 - Uri mmsUri = Uri.parse("content://media/external/images/media/23"); - returnIt = new Intent(Intent.ACTION_SEND); - returnIt.putExtra("sms_body", "yyyy"); - returnIt.putExtra(Intent.EXTRA_STREAM, mmsUri); - returnIt.setType("image/png"); 
㈡ android中uri怎麼轉換成文件路徑
方法1、用URLDecode解碼就可以了。 
String code = "D:/%e5%ad%a6%e6%b5%b7/My%20Course/%e8%ae%a1%e7%ae%97%e4%b8%8e%e8%bd%af%e4%bb%b6%e5%b7%a5%e7%a8%8b/Java%20workspace/my Project/bin/"; 
try{ 
	String src=URLDecoder.decode(code,"UTF-8");//注意編碼和輸入時一致 
	System.out.print(src); 
}catch (UnsupportedEncodingException e){			 
	e.printStackTrace(); 
} 
====== 
顯示: 
D:/學海/My Course/計算與軟體工程/Java workspace/my Project/bin/ 
 
方法2:URI有自己的getPath方法,直接返回的就是解碼後的路徑 
比如System.out.print(url.getPath());
㈢ android 中的uri到底是什麼
URI是統一資源標識符(Uniform Resource Identifier) 的意思,它的作用是根據這個URI找到某個資源文件,基本格式如: file:///sdcard/temp.jpg(就是根據你提供的例子生成的一個路徑)
ContentProvider是程序間共享數據的,它也需要生成URI供別的程序調用,格式如:
content:///StudentDB/student/name,以後你在別的程序想訪問另一個程序里的資料庫,就可以用這個URI去訪問了,而不用進行資料庫連接的操作,非常方便
URL顯得很宏觀,是網路資源定位的,而URI是應用程序內部或之間定位
㈣ android中Uri.parse()用法
通用資源標志符(Universal Resource Identifier, 簡稱"URI")。
Uri代表要操作的數據,Android上可用的每種資源 - 圖像、視頻片段等都可以用Uri來表示。Android平台而言,URI主要分三個部分:
- scheme 
- authority 
- path 
其中authority又分為host和port。格式如下:
scheme://host:port/path
實際的例子:

我們很經常需要解析Uri,並從Uri中獲取數據。
Android系統提供了兩個用於操作Uri的工具類,分別為UriMatcher 和ContentUris 。
掌握它們的使用,會便於我們的Android開發工作。
㈤ android中uri由哪三部分組成,簡述其意義
通用資源標志符(Universal Resource Identifier, 簡稱"URI")。
Uri代表要操作的數據,Android上可用的每種資源 - 圖像、視頻片段等都可以用Uri來表示。
URI一般由三部分組成:
在Android平台,URI主要分三個部分:scheme, authority and path。
其中authority又分為host和port。格式如下:scheme://host:port/path
舉個實際的例子:
content://com.example.project:200/folder/subfolder/etc
\---------/  \------------------ -/ \--/ \----------------------/
scheme                 host               port                 path
                  \---------------------------/
                          authority  
 
我們很經常需要解析Uri,並從Uri中獲取數據。
