The following code is used to change the behavior of the soft back button.
@Override
publicvoid onBackPressed() {
Toast.makeText(this, "The back button was pressed.", Toast.LENGTH_LONG).show();
return;
}
This is a discussion on Code Snippets within the LG Ally Hacking / Development forums, part of the LG Ally category; The following code is used to change the behavior of the soft back button. @Override public void onBackPressed() { Toast. makeText ( this , "The ...
The following code is used to change the behavior of the soft back button.
@Override
publicvoid onBackPressed() {
Toast.makeText(this, "The back button was pressed.", Toast.LENGTH_LONG).show();
return;
}
Motorola Droid 4
Android.net is the premier Android Forum on the internet.
The following code can be used to send some text to the default messaging app.
private EditText userText;
private EditText userPhone;
private void sendSMS(String phoneNo, String message) {
String inputText = userText.getText().toString();
String inputNumber = userPhone.getText().toString();
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.putExtra("sms_body", inputText);
sendIntent.putExtra("address", inputNumber);
sendIntent.setType("vnd.android-dir/mms-sms");
startActivity(sendIntent);
}
The following code can be used when you want to send the text to someone without using the default messaging app:
private EditText userText;
private EditText userPhone;
private void sendSMS(String phoneNo, String message) {
String inputText = userText.getText().toString();
String inputNumber = userPhone.getText().toString();
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(inputNumber, null, inputText, null, null);
Toast.makeText(getBaseContext(), "Message has been sent.", Toast.LENGTH_LONG).show();
}
The second method requires you to add permissions to send text messages.
Motorola Droid 4