0

I am using the below code to post string on twitter but instead of space, plus is getting placed in my posted string. How can I resolve this problem?

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

    mpopup.dismiss();

below is the image as how my text is looking

enter image description here

rahul
  • 2,613
  • 8
  • 32
  • 55

1 Answers1

1

The Uri.parse method takes an encoded string which is compliant with RFC-2396 . In this format, space characters are encoded to plus signs.

To get the properly formatted URL, you should do something like:

URI uri = new URI("http", "https://mobile.twitter.com/compose/tweet?status="
        + "La Mar Cebicheria"+ "     " + sharepath, null);
URL url = uri.toURL();
Community
  • 1
  • 1
Anup Cowkur
  • 20,443
  • 6
  • 51
  • 84