Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Beauty? What's that? -- Larry Wall in <199710221937.MAA25131@wall.org>


computers / comp.mobile.android / Re: Is possible to create custom Toast at Android 30+

SubjectAuthor
* Is possible to create custom Toast at Android 30+Jakub
+* Re: Is possible to create custom Toast at Android 30+Andy Burnelli
|`- Re: Is possible to create custom Toast at Android 30+Andy Burnelli
`* Re: Is possible to create custom Toast at Android 30+Joerg Lorenz
 `- Re: Is possible to create custom Toast at Android 30+Andy Burnelli

1
Is possible to create custom Toast at Android 30+

<61f7d967$0$512$65785112@news.neostrada.pl>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27130&group=comp.mobile.android#27130

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!nntp.club.cc.cmu.edu!5.161.45.24.MISMATCH!2.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Mon, 31 Jan 2022 13:44:10 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.5.1
Newsgroups: comp.mobile.android
Content-Language: pl
From: jak...@interia.pl (Jakub)
Subject: Is possible to create custom Toast at Android 30+
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 1
Message-ID: <61f7d967$0$512$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 37.47.236.66
X-Trace: 1643632999 unt-rea-a-01.news.neostrada.pl 512 37.47.236.66:22369
X-Complaints-To: abuse@news.neostrada.pl
 by: Jakub - Mon, 31 Jan 2022 12:44 UTC

Is possible to create custom Toast at Android 30+

Re: Is possible to create custom Toast at Android 30+

<st9469$e3g$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27136&group=comp.mobile.android#27136

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: comp.mobile.android
Subject: Re: Is possible to create custom Toast at Android 30+
Date: Mon, 31 Jan 2022 16:53:30 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <st9469$e3g$1@gioia.aioe.org>
References: <61f7d967$0$512$65785112@news.neostrada.pl>
Injection-Info: gioia.aioe.org; logging-data="14448"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Mon, 31 Jan 2022 16:53 UTC

On Mon, 31 Jan 2022 13:44:10 +0100, Jakub wrote:

> Is possible to create custom Toast at Android 30+

I have a good heart so I usually try to help answer questions, but in this
case, I don't even know what a "toast" is (although I vaguely remember
something about toast notifications on the Windows newsgroup long ago).

Running the obligatory search
<https://duckduckgo.com/?q=what+is+android+custom+toast+example>

First hit is:
*Android | What is Toast and How to use it with Examples*
<https://www.geeksforgeeks.org/android-what-is-toast-and-how-to-use-it-with-examples/>
"A toast is a feedback message that displays for a few seconds"
"A custom toast uses images instead of a simple message."

That article goes on to show how to _create_ a custom toast, but now we get
to the detail that the OP is asking, as we can assume the OP perhaps likely
knows something we don't about what's different about SDK 30 and above.

Modifying the search for the OP to find what changed in SDK 30 or so
<https://duckduckgo.com/?q=sdk+30+android+custom+toast+changes>

First hit is:
*Android 11: Custom toasts from the background are blocked*
<https://developer.android.com/about/versions/11/behavior-changes-11#toasts>
"For security reasons and to maintain a good user experience, the system
blocks toasts that contain custom views if those toasts are sent from
the background by an app that targets Android 11 or higher.

Note that text toasts are still allowed; these are toasts created using
Toast.makeText() that don't call setView().

If your app tries to post a toast containing a custom view from the
background anyway, the system doesn't show the message to the user.
Instead, the system logs the following message in logcat:"

Now that I have a rudimentary idea of what a "toast" even is, and then what
a "custom toast" is, and then what _changed_ (apparently in Android 12), I
provide the OP the suggestion that is made here for how to solve the issue.
<https://developer.android.com/about/versions/11/reference/compat-framework-changes>
"If your app targets Android 12 (API level 31) or higher, its toast is
limited to two lines of text and shows the application icon next to the
text. Be aware that the line length of this text varies by screen size,
so it's good to make the text as short as possible.

Alternatives to using toasts
If your app is in the foreground, consider using a snackbar instead of
using a toast. Snackbars include user-actionable options, which can
provide a better app experience.

If your app is in the background, and you want users to take some action,
use a notification instead.:"

In summary, my _first_ response, given I'm a kind hearted person who enjoys
helping others, is to suggest the OP consider using a "snackbar", although I
do profess utter ignorance myself of what a "snackbar" even is.

Before I delve into what a snackbar is, I'll let the OP respond as I don't
want to lead the OP astray given I'm completely ignorant of this topic.
--
Ignorance can be cured; it's stupidity that knows no cure.

Re: Is possible to create custom Toast at Android 30+

<st95jm$16qc$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27138&group=comp.mobile.android#27138

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: comp.mobile.android
Subject: Re: Is possible to create custom Toast at Android 30+
Date: Mon, 31 Jan 2022 17:17:43 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <st95jm$16qc$1@gioia.aioe.org>
References: <61f7d967$0$512$65785112@news.neostrada.pl> <st9469$e3g$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="39756"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Mon, 31 Jan 2022 17:17 UTC

Given Usenet is a team sport where we all play different posistions but we
teach each other like teammates who are all working together...

I should summarize what I "recommend" as an answer for the OP but I want to
openly & publicly state I am ignorant of toasts, custom toasts & snackbars.

My preliminary recommendation (after only a couple of minutes though) is:
1. Custom toasts (apparently?) _do_ work in API 30 and above (Android 11)
2. But custom toasts only work from a _foreground_ (not in a background)
3. At API 30 (Android 11) the background custom toast is merely in logcat
4. At API 31 (Android 12) there's something (similar?) called a snackbar

Of course, here I am "recommending" the OP consider a snackbar when I don't
even know what a snackbar is, but again, ignorance is eminently curable.
<https://duckduckgo.com/?q=android+toast+versus+snackbar>

First hit:
*Android Snackbar: All You Need To Know*
<https://techenum.com/learn-android-snackbar-the-material-design-way/>
"Snackbar in Android is a new more flexible widget API replacement for the
toast which we used to display some short popup like messages."

Some differences?
Toast can be positioned anywhere on the screen; snackbars are on the bottom
Snackbar can be anchored to any visible view (whatever that means)
Snackbar is more flexible than a toast
Toasts can be called from anywhere as long as the right context is passed

Toast example:
Toast.makeText(context, "Techenum is awesome!", Toast.LENGTH_LONG).show()
Snackbar example:
val snackbar: Snackbar = Snackbar.make(coordinatorLayout,
"http://nepdev.xyz", Snackbar.LENGTH_LONG)snackbar.show();

There's a lot more (of course) but on first skim, the one thing that I'm
guessing the OP wants that I don't see in the snackbar is a custom image.

Is it there?
--
Anyone afraid to let others know they are ignorant is a fool (that's why
they are fools); but they shouldn't at the same time be afraid to learn.

Re: Is possible to create custom Toast at Android 30+

<staqcl$ncd$2@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27186&group=comp.mobile.android#27186

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: hugyb...@gmx.ch (Joerg Lorenz)
Newsgroups: comp.mobile.android
Subject: Re: Is possible to create custom Toast at Android 30+
Date: Tue, 1 Feb 2022 09:18:29 +0100
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <staqcl$ncd$2@dont-email.me>
References: <61f7d967$0$512$65785112@news.neostrada.pl>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 1 Feb 2022 08:18:29 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="8fee01380ca66f2b0fa374bdd7583ded";
logging-data="23949"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184f48onkmKzoPWWzcHN9jy9+MN8pXAGFE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.5.0
Cancel-Lock: sha1:OdmVfvS6+2cV3Oqxz4lMUJfpITI=
In-Reply-To: <61f7d967$0$512$65785112@news.neostrada.pl>
Content-Language: de-CH
 by: Joerg Lorenz - Tue, 1 Feb 2022 08:18 UTC

Am 31.01.22 um 13:44 schrieb Jakub:
> Is possible to create custom Toast at Android 30+

Troll!

--
De gustibus non est disputandum

Re: Is possible to create custom Toast at Android 30+

<stbmc2$h7u$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=27202&group=comp.mobile.android#27202

  copy link   Newsgroups: comp.mobile.android
Path: i2pn2.org!i2pn.org!aioe.org!3PLzD/rb74ta/CXxNcmbeA.user.46.165.242.75.POSTED!not-for-mail
From: spa...@nospam.com (Andy Burnelli)
Newsgroups: comp.mobile.android
Subject: Re: Is possible to create custom Toast at Android 30+
Date: Tue, 1 Feb 2022 16:16:03 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <stbmc2$h7u$1@gioia.aioe.org>
References: <61f7d967$0$512$65785112@news.neostrada.pl> <staqcl$ncd$2@dont-email.me>
Injection-Info: gioia.aioe.org; logging-data="17662"; posting-host="3PLzD/rb74ta/CXxNcmbeA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
 by: Andy Burnelli - Tue, 1 Feb 2022 16:16 UTC

On Tue, 1 Feb 2022 09:18:29 +0100, Joerg Lorenz wrote:

>> Is possible to create custom Toast at Android 30+
>
> Troll!

Joerg,
I'm going to ask you a question and hope you respond as an adult.

Given toasts _did_ change in Android 11 & 12 (API 30 & 31)... the user's
question appears to be perfectly valid, to me.

On what basis do you feel that the question is a troll?
--
Note that no response from Joerg _is_ a resposne (e.g., he's the troll).

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor