I'm trying to update the toast value at different instances in my code. I tried to instantiate an object like this:
Toast mToast = Toast.makeText(this,"",Toast.LENGTH_SHORT);
and update its value whenever I needed inside my code. Like this:
mToast.setText("Hello!");
The initial instantiation seems to be crashing my code.
Any clues why this would happen?
If the app crash when you instantiate your Toast, it could be for the wrong context in the constructor. Where do you declare it? be sure to get your real context.
You can't update the Toast for real, but you can hide the toast and make a new one.
Use mToast.cancel();
to remove your Toast, then
mToast.setText("New text");
mToast.show();