1

i am trying to make converter by getting input from editText then encode it and get back decoded value. i want to do this on editText event or if not possible then on button click event? complete this code please

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        EditText ed1 = (EditText) findViewById(R.id.editText);
        EditText ed2 = (EditText) findViewById(R.id.editText2);


      String  text = Base64.encodeToString(ed1.getText().toString().getBytes(), Base64.DEFAULT );
      String  text2 = new String( Base64.decode(text, Base64.DEFAULT ) );

    }
}
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Kinza Yasin
  • 19
  • 1
  • 2

0 Answers0