I'm attempting to check to ensure the device has a MAC address set using java - however I'm having trouble implementing the check to do so. I've attempted to use the following:
if (MAC == "00:00:00:00:00:00"){
AlertDialog.Builder builder = new AlertDialog.Builder(ActivityMain.this);
builder.setMessage("You Have No MAC Address!")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//do things
}
});
AlertDialog alert = builder.create();
alert.show();
}
However the condition is never met - even with the value of MAC set to 00:00:00:00:00:00.
I thought this might be the way I am comparing to the two values. So then I tried this:
if (MAC = "00:00:00:00:00:00"){
AlertDialog.Builder builder = new AlertDialog.Builder(ActivityMain.this);
builder.setMessage("You Have No MAC Address!")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//do things
}
});
AlertDialog alert = builder.create();
alert.show();
}
But I end up with the error: Type mismatch cannot convert from a String to a Boolean.
My question is: What would be the best method of resolving this issue?