在twitter上发布文本时,加上是放置而不是空格

时间:2014-01-03 07:03:36

标签: android string twitter

我使用下面的代码在twitter上发布字符串,但不是空格,而是放在我发布的字符串中。我该如何解决这个问题?

Intent inte = new Intent(
      Intent.ACTION_VIEW,
      Uri.parse("https://mobile.twitter.com/compose/tweet?status="
        + "La Mar Cebicheria"+ "     " + sharepath));
    startActivity(inte);

    mpopup.dismiss();

下面是我的文字看起来的图像

enter image description here

1 个答案:

答案 0 :(得分:1)

Uri.parse方法采用符合RFC-2396的编码字符串。采用此格式space characters are encoded to plus signs

要获得格式正确的网址,您应该执行以下操作:

URI uri = new URI("http", "https://mobile.twitter.com/compose/tweet?status="
        + "La Mar Cebicheria"+ "     " + sharepath, null);
URL url = uri.toURL();