android-toast

Display two Toast messages at once?

本小妞迷上赌 提交于 2020-01-02 02:36:08
问题 I would like one Toast message to display in one location and a different Toast message to display in another location simultaneously. Multiple Toast messages seem to always queue and display in order. Is it possible to show both messages at the same time? Is there a workaround that at least gives that appearance and doesn't involve messing with the activity layout? Edit: It seems the answer to the first question is no, it's not possible. How about a workaround? A solution for me would

IllegalStateException of toast View on Android P preview

限于喜欢 提交于 2020-01-01 12:11:31
问题 While trying to release my app for production, the pre-launch report notified me of an error on Pixel 2 Android P Preview device. The error is related to a custom toast message I have, saying that a View "has already been added to the window manager": java.lang.IllegalStateException: View android.support.constraint.ConstraintLayout{efbeb21 V.E...... ......ID 0,0-788,1124 #7f0900db app:id/toast_correct_container} has already been added to the window manager. at android.view.WindowManagerGlobal

Disabling notification also disables toast messages of the app

眉间皱痕 提交于 2020-01-01 07:24:06
问题 In my android app , I have implemented push notification.My problem is from my device if I disable notification messages for the app, even the toast messages get disabled. Is this a usual phenomenon or do I need to change anything ? Please let me know how can I overcome this. 回答1: Yes,it's a usual phenomenon.Click here but it's in Chinese.Hope this can help you. In such case,it is need to write a Toast by your self.I can provide a demo but it is not complete.You can do some modification to

Is it possible to disable Toasts or wait until toast disappears while testing

社会主义新天地 提交于 2019-12-30 09:13:49
问题 I am testing an app with Espresso . I have one question is it possible to wait until there are no toast are currently being showed. I have a lot of different toast in my app, but while testing I have problems with them because as far as I can guess focus is gone to the toast and I am getting quite another view hierarchy as I can see in error logs. So my question is it possible to hide all (system wide with root access) or just wait until there are any toasts on the screen or maybe if it is

Making a Color Toast in Android

此生再无相见时 提交于 2019-12-25 03:05:13
问题 I have seen sometimes a Blue toast showing up when i connect my Samsung phone with wifi network. Can anyone help for customising the colour of the toast. For example: 回答1: Try This:- SpannableString text = new SpannableString("Please Wait !!!!! "); text.setSpan(new ForegroundColorSpan(Color.BLUE), 0, 41, 0); Toast.makeText(c.getApplicationContext(),text , Toast.LENGTH_LONG).show(); Another Way:- Make an xml / customToast.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res

Custom toast message in all screens?

痴心易碎 提交于 2019-12-22 00:11:28
问题 I have developed one application which has 15 screens. Now I want to display custom toast message in all those 15 screens. To do so, I have inflated one layout. But it's working only on one screen. So, I wrote a single method to display custom Toast on all screens. Whenever I want to display toast message, I would just call that method. But i got java.lang.NullPointerException . How to resolve this? The following is my code, public static void showToastMessage(String message){ LayoutInflater

controling the displaying time of a toast [duplicate]

走远了吗. 提交于 2019-12-21 23:48:19
问题 This question already has answers here : How can I show a toast for a specific duration? (13 answers) Closed 5 years ago . I used toasts in my android application. Can I show the toast as long as i wish instead of Toast.LENGTH_LONG and Toast.LENGTH_SHORT can someone help me with some helpful code segment. Thank you. 回答1: What you can do is create a method which with some kind of looping around to make your Toast display as long as duration you want it, private void showToast(int duration) {

What is the value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT?

为君一笑 提交于 2019-12-21 03:12:07
问题 I am printing Toast message in my application to show notification but i want to know value of Toast.LENGTH_LONG and Toast.LENGTH_SHORT. What other values i can use. Can anyone tell me what is the value of these two variables? 回答1: There is another question that answers what you are looking for. The answers are: private static final int LONG_DELAY = 3500; // 3.5 seconds private static final int SHORT_DELAY = 2000; // 2 seconds This was courtesy of FeelGood. You can find the whole thread below

How can i change default toast message color and background color in android?

大憨熊 提交于 2019-12-18 10:49:09
问题 I want to create a toast message with background color is white and message color is black. My toast message is: Toast.makeText(Logpage.this, "Please Give Feedback...", 3000).show(); I wanted to create it in another method not in onCreate() . 回答1: You can create the custom toast message like below : Toast toast = new Toast(context); toast.setDuration(Toast.LENGTH_LONG); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater

Is there code for Snackbars in Android L or are we expected to implement them ourselves?

最后都变了- 提交于 2019-12-18 03:56:49
问题 The Material design website mentions a new Toast-like element called a Snackbar: http://www.google.com/design/spec/components/snackbars-and-toasts.html The Android L preview SDK documentation (sorry can't link since it's only downloadable) doesn't have any mention of Snackbar in the classes list or as a modifier in the Toast class documentation. Am I missing something obvious or should I build my own Snackbar.java? 回答1: Update 2015-05-29: Google released a Design Support Library which