Created
November 6, 2016 06:41
-
-
Save tmk815/e3e1573ea5ae2f5fe6ca27330243647a to your computer and use it in GitHub Desktop.
Encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String msg ="改行文字入りテキスト"; | |
String enc; | |
try { | |
//文字をエンコード | |
enc = URLEncoder.encode(msg, "utf-8"); //(エンコードしたい変数,"文字コード") | |
} catch (UnsupportedEncodingException e) { | |
//エンコード失敗時 | |
} | |
//LINEで送信 | |
try{ | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse("line://msg/text/" + enc)); | |
startActivity(intent); | |
}catch(Exception e){ | |
//LINEが入ってなかった場合の処理 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment