Tag: fragments
-
Android Toasts (e.g. small notifications), how to use in Fragments
The syntax is very simple. The example below is invoked from inside a Fragment, so the first parameter (Context) is the activity that holds the fragment: Toast.makeText(getActivity(),R.string.asset_added_fav,Toast.LENGTH_SHORT).show(); The second parameter is the message, the third is the duration, Toast.makeText returns an instance of Toast, that we “.show()” immediately.