如何在 android 中使用 Uri.Parse 解析 '#' 符号
How to parse '#' simbol using Uri.Parse in android
嘿...我正在编写这样的代码:
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:*123#"));
startActivity(callIntent);
上面的callIntent是用来呼叫phone号码*123#的,但是我运行代码的时候,只是呼叫*123没有#。我试过把'/'放在#前面,但结果是一样的,只是*123没有#...
我阅读了开发人员中的 Uri android 然后发现了这个:
public 抽象字符串getEncodedFragment()
但我真的不知道这个方法到底是做什么的...:)
任何人都可以帮助解决这个问题...?? :),关于如何使用 Uri.parse..
提前致谢....我真的很感谢你的回答...:)
我想你想要的是不可能的,快速搜索将引导你到 this solution
更多详情请看here
encodedHash
对 # 字符进行编码。你可以随它去
String encodedHash = Uri.encode("#");
startActivity(new Intent("android.intent.action.DIAL",
Uri.parse("tel:"+ "*123"+ encodedHash)));
来自先生。 Simon link...我找到了答案:)
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+Uri.encode("*123#")));
所以我刚刚添加了 Uri.encode("*123#");而“#”仍然存在....
感谢 aaaa looot Mr. Simon...呵呵呵呵.. :)
嘿...我正在编写这样的代码:
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:*123#"));
startActivity(callIntent);
上面的callIntent是用来呼叫phone号码*123#的,但是我运行代码的时候,只是呼叫*123没有#。我试过把'/'放在#前面,但结果是一样的,只是*123没有#...
我阅读了开发人员中的 Uri android 然后发现了这个: public 抽象字符串getEncodedFragment() 但我真的不知道这个方法到底是做什么的...:)
任何人都可以帮助解决这个问题...?? :),关于如何使用 Uri.parse.. 提前致谢....我真的很感谢你的回答...:)
我想你想要的是不可能的,快速搜索将引导你到 this solution
更多详情请看here
encodedHash
对 # 字符进行编码。你可以随它去
String encodedHash = Uri.encode("#");
startActivity(new Intent("android.intent.action.DIAL",
Uri.parse("tel:"+ "*123"+ encodedHash)));
来自先生。 Simon link...我找到了答案:)
Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+Uri.encode("*123#")));
所以我刚刚添加了 Uri.encode("*123#");而“#”仍然存在....
感谢 aaaa looot Mr. Simon...呵呵呵呵.. :)