The notification LEDs are not a standard feature on Android. That said, you can't have a single method which will handle the blinking for all Android devices.
An way to solve this issue is to create a generic method, which will check the brand of the phone, and use the appropriated method to blink the LED. Something like:
private void blinkLED() {
String man = android.os.Build.MANUFACTURER;
if (man.equals("SAMSUNG")) {
// Do Samsung LED blinking here.
}
else if (man.equals("HTC")) {
// Do HTC LED blinking here.
}
else {
// ...
}
}
And to change your background color, get the reference for your root layout, and call the setBackgroundColor
method, which all objects who inherits from android View
have.
RelativeLayout lv = (RelativeLayout) findViewById(R.id.relativelayout);
Button bt = (Button) findViewById(R.id.button);
bt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
lv.setBackgroundColor(Color.rgb(204,0,0));
}
});
Edit: From what I could understand, you want to notify the user that your message was sent. I can suggest an easy way for you to do it.
Use the ProgressDialog
and AlertDialog
classes. Use it if you want to show the progress of the sending process to the user and notify when the process is done. To start a progress dialog is simple, just add this line:
// this refers to a Context, the second argument is the title of the dialog, the third argument is the body message of the dialog, the fourth argument is whether your dialog is indeterminate or not, the last argument tells if your dialog can be canceled or not.
ProgressDialog pd = ProgressDialog.show(this,"Title of dialog","(Body message) Sending message",true,false);
And to cancel it, or disable it, just call:
pd.dismiss();
And to show an AlertDialog, just do the following.
new AlertDialog.Builder(getApplicationContext())
.setTitle("Title")
.setMessage("Your message was sent!")
.setPositiveButton("OK",null)
.show();
That should do what you want.