Reputation: 984
I want to break new line in SMS.
This is my code :
public void sendSMS()
{
String time;
SimpleDateFormat dayFormat = new SimpleDateFormat("HH:mm:ss", Locale.US);
Calendar calendars = Calendar.getInstance();
time = dayFormat.format(calendars.getTime());
String phoneNumber = "xxxxxxxx";
String message = "This SMS Was sent at : " + time + ". Ruang = " + ruang + ". Lantai = " + lantai + "nama = " + nama_mahasiswa + "No = " + noHP_orangtua;
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);
}
In String message, I want to add break new line so it would show more good looking. Could you help me ?
Upvotes: 3
Views: 3032
Reputation: 11909
Try this
String message = "This SMS Was sent at : " + time + ".\nRuang = " + ruang + ". Lantai = " + lantai + "nama = " + nama_mahasiswa + "No = " + noHP_orangtua;
The "\n" inside the string might do the trick, but I've never worked with SMS in android, so I can't be sure if it will work.
Upvotes: 4