I'm creating an android app that converts ascii to binary. But I can't figure out on how to access a string I made outside the for-loop. if I type in binary(var name) android studio gives me an error. Here's my code(it's only in the on-click listener)
String output = "";
String input = textEditText.getText().toString();
int length = input.length();
for (int i = 0;i < length;i++) {
char c = input.charAt(i);
int value = Integer.valueOf(c);
String binaryOutpt2 = Integer.toBinaryString(value);
String binary = output + binaryOutpt2;
}