How can i set a global error message for the entire application?
As of now, i am adding an TextView with text set to “” in the layout of every activity and when some error occurs, i am adding that error message to that TextView and displaying it to the user. I don’t think it is a good approach to add an empty TextView in the layout of every activity, hence i am thinking of adding only one TextView somewhere which can be displayed in the layout of all the activity for the error messages.
Or, even may be some other approach other than adding an empty Textview.
Please suggest.
Regards,
By far the easier, and better applied for the appearance of your app is an AlertDialog.
It is super easy to implement using the alertdialog builder.
It created a pop-up alert with one button to dismiss it. You don’t have to add anything on the layouts and you can execute it anywhere on your code.
You can also set more attributes and make it even more beautiful and informative for the user like title or icons etc.
I will be much better to try this feature than a textview. This is the result of the code above.