I am trying to add up the characters in a String. But that doesn't seem to work. I am using this code:
public String createDeciOfOct (String number) {
int result = 0;
String[] numberArray = number.split("");
for (String numb : numberArray) {
if(numb != null || numb != "") {
result += Integer.parseInt(numb);
}
}
return Integer.toString(result);
}
How I am executing it is like this:
frmOctToDeci.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText edtTxt = (EditText) findViewById(R.id.octalValue);
String value = edtTxt.getText().toString();
String result = createDeciOfOct(value);
TextView txtView = (TextView) findViewById(R.id.fromOctRes);
txtView.setText(result);
}
});
It gives me an error as:
java.lang.NumberFormatException: Invalid int: ""
Which means that there is some sort of empty string. How can I prevent this?
The logcat errors are as:

""and you compare strings withequals,==is just for references