Skip to content

Instantly share code, notes, and snippets.

@tmk815
Created November 6, 2016 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmk815/e3e1573ea5ae2f5fe6ca27330243647a to your computer and use it in GitHub Desktop.
Save tmk815/e3e1573ea5ae2f5fe6ca27330243647a to your computer and use it in GitHub Desktop.
Encoding
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