Jun 21, 2012 Replies: 45 Hello All, Updated: [June 30th, 2012]. Added more functions to set options for a new ToastShow and added sound. All are attached below. NOTE: The new one requires the Audio library and only two parameters to be passed! See Post #: 11 for more information. Updated: [June 24th, 2012] and added support for 9 Patch Images. The original is unchanged and both are attached below. Here is a custom toast message class. It allows a number of features over the standard toast message. Below is a list of what can be set in this custom toast message class: The message. It will wrap the message if it is longer than one line. The text size The text color The message background color if no image is used The toast message background image The vertical position The horizontal position The number of seconds to display Can be closed immediately in code Select auto close or close by Tapping the message Uses the new Reflection library 2.20. Version 1.0 is attached to this post with Demo Code. Margret Erel the new B4A classes are awesome!! Attachments CToastClass.zip CToastClass.zip 14.1 KB · Views: 2,264 CToast_9Patch.zip CToast_9Patch.zip 19.1 KB · Views: 1,528 CToast_9PatchSound.zip CToast_9PatchSound.zip 20.4 KB · Views: 1,558 Last edited: Jul 1, 2012 Click to expand...
Hello All, Updated: [June 30th, 2012]. Added more functions to set options for a new ToastShow and added sound. All are attached below. NOTE: The new one requires the Audio library and only two parameters to be passed! See Post #: 11 for more information. Updated: [June 24th, 2012] and added support for 9 Patch Images. The original is unchanged and both are attached below. Here is a custom toast message class. It allows a number of features over the standard toast message. Below is a list of what can be set in this custom toast message class: The message. It will wrap the message if it is longer than one line. The text size The text color The message background color if no image is used The toast message background image The vertical position The horizontal position The number of seconds to display Can be closed immediately in code Select auto close or close by Tapping the message Uses the new Reflection library 2.20. Version 1.0 is attached to this post with Demo Code. Margret Erel the new B4A classes are awesome!!
LucaMs Expert Licensed User Longtime User Dec 14, 2013 #42 Hi. Your class, which for me would be useful to be able to close a toast, interferes with IME lib. (IME disturbs often). I use the IME to make visible an EditText that has the focus, and this works well, but, if I use your class, the EditText is covered by the keyboard.
Hi. Your class, which for me would be useful to be able to close a toast, interferes with IME lib. (IME disturbs often). I use the IME to make visible an EditText that has the focus, and this works well, but, if I use your class, the EditText is covered by the keyboard.
metrick Active Member Licensed User Longtime User Mar 9, 2014 #43 synapse said: Fatal signal 11 (SIGSEGV) I wondered if anyone had come across this error please? It occurs with CToast but not Toast, crashing the app randomly on 4.2.2 but not, seemingly, 2.3.6. Click to expand... I have the same problem with 4.2.2.
synapse said: Fatal signal 11 (SIGSEGV) I wondered if anyone had come across this error please? It occurs with CToast but not Toast, crashing the app randomly on 4.2.2 but not, seemingly, 2.3.6. Click to expand... I have the same problem with 4.2.2.
margret Well-Known Member Licensed User Longtime User Mar 9, 2014 #44 LucaMs said: Hi. Your class, which for me would be useful to be able to close a toast, interferes with IME lib. (IME disturbs often). I use the IME to make visible an EditText that has the focus, and this works well, but, if I use your class, the EditText is covered by the keyboard. Click to expand... Can you post a cut down version of the project that shows this? If so, I will be glad to look at it.
LucaMs said: Hi. Your class, which for me would be useful to be able to close a toast, interferes with IME lib. (IME disturbs often). I use the IME to make visible an EditText that has the focus, and this works well, but, if I use your class, the EditText is covered by the keyboard. Click to expand... Can you post a cut down version of the project that shows this? If so, I will be glad to look at it.
Dave O Well-Known Member Licensed User Longtime User Mar 13, 2015 #45 Hi Margret, Thanks for this handy (and blissfully small) class. I needed a toast that could be closed on demand (because the normal toast gets behind if you have quick successive actions), and this does the job nicely. I also tweaked the code to let me specify corner radius and border color as arguments, which makes it look a bit more like the standard toast: Code: Copy Sub ToastMessageShow2(..., Tradius As Int) ... If Timage <> "" Then ... Else Dim panelDrawable As ColorDrawable panelDrawable.Initialize2(Tbackcolor, Tradius, 1, Colors.LightGray) TMS2pan.Background = panelDrawable End If ... Thanks again! Last edited: Mar 14, 2015
Hi Margret, Thanks for this handy (and blissfully small) class. I needed a toast that could be closed on demand (because the normal toast gets behind if you have quick successive actions), and this does the job nicely. I also tweaked the code to let me specify corner radius and border color as arguments, which makes it look a bit more like the standard toast: Code: Copy Sub ToastMessageShow2(..., Tradius As Int) ... If Timage <> "" Then ... Else Dim panelDrawable As ColorDrawable panelDrawable.Initialize2(Tbackcolor, Tradius, 1, Colors.LightGray) TMS2pan.Background = panelDrawable End If ... Thanks again!
G ginsh Member Licensed User Longtime User Apr 18, 2015 #46 Hi Margret, How can we use Ctoast in a service module?