This question already has an answer here:
- How do I display an alert dialog on Android? 27 answers
I need to show a little text message to the users that clicks a button on my Android app, on IOS I just had to create an AlertView that it's simple to use but with Android i'm struggling because the solution seems x10 times harder. I saw that I need to use a DialogFragment but I can't understand how to make it work, can someone explain? Also, is my solution right or there is something easier to show a simple text message to users?
You would simply need to do this in your
onClick
:I don't know from where you saw that you need DialogFragment for simply showing an alert.
Hope this helps.
You can easily make your own 'AlertView' and use it everywhere.
Implement it once:
No my friend its very simple, try using this:
This tutorial shows how you can create custom dialog using xml and then show them as an alert dialog.