In order to "display Toast" in your application, try this:
Toast.makeText(getActivity(), (String)data.result,
Toast.LENGTH_LONG).show();
other example...
Toast.makeText(getActivity(), "this is my Toast message!!! =)",
Toast.LENGTH_LONG).show();
We can define two constats for duration:
int LENGTH_LONG Show the view or text notification for a long period of time.int LENGTH_SHORT Show the view or text notification for a short period of time.
Read more about "Toasts"
other option, customizing your toast:
LayoutInflater myInflater=LayoutInflater.from(this);
View view=myInflater.inflate(R.layout.your_custom_layout,null);
Toast mytoast=new Toast(this);
mytoast.setView(view);
mytoast.setDuration(Toast.LENGTH_LONG);
mytoast.show();
No comments:
Post a Comment