I need to parse a single text from my MainActivity.java to all other activities in my app.
Is it possible to do so?
I need to parse a single text from my MainActivity.java to all other activities in my app.
Is it possible to do so?
Just store the text as string in shared preferences
and then get the string in other activities.. or you can also use broadcast receiver
in all other activities. But first all the activities should call the receiver
first then the MainActivity can send the text.
In MainActivity,
this.getSharedPreferences("MyPrefName", Context.MODE_PRIVATE).edit().putString("parsetext","yourtext").apply();
and in the other activities..
this.getSharedPreferences("MyPrefName", Context.MODE_PRIVATE).getString("parsetext","");