I'm trying to get an if statement to test for null values to work, but it my app just seems to ignore it. below is my current code (woreks perfectly aside from the second if statement.
public void stuff(View v){
the_problem_string = "";
//this one works
if (another_string == null){
please_wait_for_value_msg = Toast.makeText(getApplicationContext(), "Please wait for values", Toast.LENGTH_SHORT);
please_wait_for_value_msg.setGravity(Gravity.TOP|Gravity.CENTER, 0, 250);
please_wait_for_value_msg.show();
return;
}
AlertDialog.Builder save = new AlertDialog.Builder(this);
save.setTitle("Save Location");
save.setMessage("Enter description");
final EditText input = new EditText (this);
save.setView(input);
save.setPositiveButton("Ok", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int whichButton) {
Editable value = input.getText();
String something = value.toString();
the_problem_string = something;
//this is what is not working
if (the_problem_string == null || the_problem_string == ""){
please_enter_description_msg = Toast.makeText(getApplicationContext(), "Please enter a description", Toast.LENGTH_SHORT);
please_enter_description_msg.setGravity(Gravity.TOP|Gravity.CENTER, 0, 250);
please_enter_description_msg.show();
return;
}do a lot more stuff
}
});
save.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
return;
}
});
save.show();
}
The problem I'm having is with that second if statement. I need it to not "do a lot more stuff" if the_problem_string is null (or otherwise has no entered value). I'm sure its just something small I'm overlooking, but can someone point me in the right direction or at least help understand why I'm not getting the desired results?