當前位置:首頁 » 安卓系統 » androiduri

androiduri

發布時間: 2025-05-24 07:58:23

㈠ android中Uri.parse()用法是什麼

  1. 調web瀏覽器
    Uri myBlogUri = Uri.parse("http://xxxxx.com");
    returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);

  2. 地圖

    Uri mapUri = Uri.parse("geo:38.899533,-77.036476");
    returnIt = new Intent(Intent.ACTION_VIEW, mapUri);

  3. 調撥打電話界面
    Uri telUri = Uri.parse("tel:100861");
    returnIt = new Intent(Intent.ACTION_DIAL, telUri);

  4. 直接撥打電話
    Uri callUri = Uri.parse("tel:100861");
    returnIt = new Intent(Intent.ACTION_CALL, callUri);

  5. 卸載
    Uri uninstallUri = Uri.fromParts("package", "xxx", null);
    returnIt = new Intent(Intent.ACTION_DELETE, uninstallUri);

  6. 安裝
    Uri installUri = Uri.fromParts("package", "xxx", null);
    returnIt = new Intent(Intent.ACTION_PACKAGE_ADDED, installUri);

  7. 播放
    Uri playUri = Uri.parse("file:///sdcard/download/everything.mp3");
    returnIt = new Intent(Intent.ACTION_VIEW, playUri);

  8. 調用發郵件
    Uri emailUri = Uri.parse("mailto:[email protected]");
    returnIt = new Intent(Intent.ACTION_SENDTO, emailUri);

  9. 發郵件
    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");

  10. 發簡訊

    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")

  11. 直接發郵件

    Uri smsToUri = Uri.parse("smsto://100861");

    returnIt = new Intent(Intent.ACTION_SENDTO, smsToUri);

    returnIt.putExtra("sms_body", "yyyy");

  12. 發彩信

    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主要分三個部分:

  1. scheme

  2. authority

  3. 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中獲取數據。

熱點內容
為什麼要使用雲伺服器 發布:2025-05-24 11:03:27 瀏覽:929
建立自己的資料庫 發布:2025-05-24 11:01:56 瀏覽:990
安卓php文件 發布:2025-05-24 11:01:17 瀏覽:896
c語言歷年真題及答案 發布:2025-05-24 11:01:15 瀏覽:430
java網路培訓班 發布:2025-05-24 10:52:05 瀏覽:800
編程貓有用嗎 發布:2025-05-24 10:47:47 瀏覽:357
玩上c語言 發布:2025-05-24 10:47:09 瀏覽:853
視頻會議加密 發布:2025-05-24 10:35:47 瀏覽:648
國六桑塔納哪個配置最好 發布:2025-05-24 10:35:37 瀏覽:728
android的context 發布:2025-05-24 10:35:35 瀏覽:100