簡體   English   中英

如何在Android編程的Uri.parse中使用“#”

[英]How do I use “#” in Uri.parse in android programming

我試圖在代碼中解析*123# ,但是無論何時運行程序, #似乎都不會出現:

protected void makeCall(){
    Log.i("make call", "");

    Intent phoneIntent = new Intent(Intent.ACTION_CALL);
    phoneIntent.setData(Uri.parse("tel: *123#"));

    try{
        startActivity(phoneIntent);
        finish();
        Log.i("finish making call...", "");
    }catch (android.content.ActivityNotFoundException ex){
        Toast.makeText(MainActivity.this,"call failed",Toast.LENGTH_LONG).show();
    }
} 

這個你能幫我嗎。

protected void makeCall(){
    Log.i("make call", "");

    Intent phoneIntent = new Intent(Intent.ACTION_CALL);
    phoneIntent.setData(Uri.parse("tel:*123#"));

    try{
        startActivity(phoneIntent);
       // finish();
        Log.i("finish making call...", "");
    }catch (android.content.ActivityNotFoundException ex){
        Toast.makeText(MainActivity.this,"call failed",Toast.LENGTH_LONG).show();
    }
} 

還必須在清單中添加<uses-permission android:name="android.permission.CALL_PHONE" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM