How to float Toast on Android.

Asked 2 years ago, Updated 2 years ago, 93 views

How do I float Toast on Android?

android android-mapview android-asynctask toast

2022-09-22 22:25

1 Answers

Toast.makeText(getActivity(), (String)data.result, 
   Toast.LENGTH_LONG).show();
Toast.makeText(getActivity(), "this is my Toast message!!! =)",
   Toast.LENGTH_LONG).show();

You can do it like this.

For LENGTH_LONG, the Toast is shown for a long time LENGTH_SHORT appears short.

```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();

If you do it like this, you can print out a custom toast.


2022-09-22 22:25

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.