# Android Notification

**URL:** <https://discourse.processing.org/t/android-notification/28854>\
**Category:** Processing for Android\
**Created:** [March 25, 2021, 11:41pm UTC](https://discourse.processing.org/t/android-notification/28854 "2021-03-25T23:41:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 25, 2021, 11:41pm UTC](https://discourse.processing.org/t/android-notification/28854/1 "2021-03-25T23:41:38Z")

</div>

![main](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/1X/9555454d067b8e846df100ac0381b83eb8372983.jpg)

Can someone Help me i need this for my Game

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 26, 2021, 3:29am UTC](https://discourse.processing.org/t/android-notification/28854/2 "2021-03-26T03:29:24Z")

</div>

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/4429/notifications-in-android-mode)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.

Not sure its entirely possible processing seems limited to one activity.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 26, 2021, 8:25am UTC](https://discourse.processing.org/t/android-notification/28854/3 "2021-03-26T08:25:24Z")

</div>

I have 3 err.

```auto
----------
1. ERROR in /data/user/0/com.calsignlabs.apde/app_build/src/processing/test/sketch_20210326i/sketch_20210326i.java (at line 36)
	String txt = t;
	             ^
t cannot be resolved
----------
2. ERROR in /data/user/0/com.calsignlabs.apde/app_build/src/processing/test/sketch_20210326i/sketch_20210326i.java (at line 40)
	int time = n;
	           ^
n cannot be resolved
----------
3. ERROR in /data/user/0/com.calsignlabs.apde/app_build/src/processing/test/sketch_20210326i/sketch_20210326i.java (at line 74)
	Toast.makeText(this, txt, time).show();
	      ^^^^^^^^
The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (TOASTnotifications, String, int)
----------
3 problems (3 errors)

```

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 26, 2021, 10:46am UTC](https://discourse.processing.org/t/android-notification/28854/4 "2021-03-26T10:46:18Z")

</div>

Read the errors. The first 2 say they cant find variables whilst the last one says there is no method makeText that takes 3 params. So check the method or add the method and initialise your variables.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 26, 2021, 12:15pm UTC](https://discourse.processing.org/t/android-notification/28854/5 "2021-03-26T12:15:04Z")

</div>

and how do i add them? I’ve never done it before

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 26, 2021, 5:24pm UTC](https://discourse.processing.org/t/android-notification/28854/6 "2021-03-26T17:24:05Z")

</div>

@paulgoux can you Help me?

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 26, 2021, 5:27pm UTC](https://discourse.processing.org/t/android-notification/28854/7 "2021-03-26T17:27:58Z")

</div>

Do you have the full code? Ill take a look when i get a mo

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [March 26, 2021, 6:22pm UTC](https://discourse.processing.org/t/android-notification/28854/8 "2021-03-26T18:22:45Z")

</div>

@Rogo === as for the 2 first errors we have to see the code as @paulgoux said; as for the 3 error (toast) toast is waiting a context; as for the notification you can do that with P5 because it is a service.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 26, 2021, 9:26pm UTC](https://discourse.processing.org/t/android-notification/28854/9 "2021-03-26T21:26:24Z")

</div>

Yes one Moment please

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 26, 2021, 9:27pm UTC](https://discourse.processing.org/t/android-notification/28854/10 "2021-03-26T21:27:45Z")

</div>

```auto
import android.os.Looper; 

import android.widget.Toast;                  

 

class TOASTnotifications extends Thread {

 

  // Text of the notification

  String txt = t;

  // Duration of the notification

  int time = n;

 

  public TOASTnotifications (String t, int n) {

    txt= t;

    time = n;

  }

 

 

  public void start() {

    super.start();

  }

 

  //@Override

    public void run() {

 

    Looper.prepare();

 

    Toast.makeText(this, txt, time).show();

 

    Looper.loop();

  }

 

}

```

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 27, 2021, 1:45pm UTC](https://discourse.processing.org/t/android-notification/28854/11 "2021-03-27T13:45:32Z")

</div>

is this the complete code, it seems incomplete?

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 27, 2021, 6:12pm UTC](https://discourse.processing.org/t/android-notification/28854/12 "2021-03-27T18:12:53Z")

</div>

Yes its the full Code 😕

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 27, 2021, 10:18pm UTC](https://discourse.processing.org/t/android-notification/28854/13 "2021-03-27T22:18:07Z")

</div>

Little lost is this your own code or something you found online.

In any case some variables at least from what i can see are never initialised so i would probably suggest that first.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 28, 2021, 11:34am UTC](https://discourse.processing.org/t/android-notification/28854/14 "2021-03-28T11:34:09Z")

</div>

Can’t someone tell me what to do and how to do it? I don’t know how to do it

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 28, 2021, 12:28pm UTC](https://discourse.processing.org/t/android-notification/28854/15 "2021-03-28T12:28:54Z")

</div>

Then place at the top of your sketch.

```auto
String txt = "sometext" ;

  // Duration of the notification

  int time = 1;

```

However the better question would be is how much understanding do you have about coding? If you are struggling with variables then this project is likely going to be difficult.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 28, 2021, 1:46pm UTC](https://discourse.processing.org/t/android-notification/28854/16 "2021-03-28T13:46:01Z")

</div>

I now only have this one error

```auto
----------
1. ERROR in /data/user/0/com.calsignlabs.apde/app_build/src/processing/test/sketch_20210328f/sketch_20210328f.java (at line 72)
	Toast.makeText(this, txt, time).show();
	      ^^^^^^^^
The method makeText(Context, CharSequence, int) in the type Toast is not applicable for the arguments (TOASTnotifications, String, int)
----------

```

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 28, 2021, 1:47pm UTC](https://discourse.processing.org/t/android-notification/28854/17 "2021-03-28T13:47:34Z")

</div>

I only have difficulties with my English because I come from Germany

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 28, 2021, 1:48pm UTC](https://discourse.processing.org/t/android-notification/28854/18 "2021-03-28T13:48:26Z")

</div>

In any case i still get errors after attempting to build this. For some reason its confusing the string for a charSequence and doesnt know how to resolve it.

> **[Android Toast Example - javatpoint](https://www.javatpoint.com/android-toast-example)**
>
> Android Toast Example with examples of Activity and Intent, Fragments, Menu, Service, alarm manager, storage, sqlite, xml, json, multimedia, speech, web service, telephony, animation and graphics

Might be able to help you further. I do not understand all the complexities of android coding so id have to do some research before having the answer.

Our old friend Noel did a lot of work in android and ive checked his github but no luck. So you have to be patient, because again its not my area of expertise.

Also its looking for a context and not a toast notification.

At this point though all im doing is trying to understand the error.

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 28, 2021, 1:54pm UTC](https://discourse.processing.org/t/android-notification/28854/19 "2021-03-28T13:54:34Z")

</div>

> <https://stackoverflow.com/questions/16138004/processing-received-sms-as-a-toast-in-android>

[https://docs.huihoo.com/android/3.0/guide/topics/ui/notifiers/toasts.html](https://docs.huihoo.com/android/3.0/guide/topics/ui/notifiers/toasts.html)

And finally

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/6913/toast-in-processing)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.

These shoulde have the answer you’re looking for.

---

<div class="post-metadata">

**Author:** ![Rogo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rogo/32/12349_2.png) [@Rogo](https://discourse.processing.org/u/Rogo)\
**Post date:** [March 28, 2021, 2:13pm UTC](https://discourse.processing.org/t/android-notification/28854/20 "2021-03-28T14:13:30Z")

</div>

Nice thank you 🙂

[Next page](https://discourse.processing.org/t/android-notification/28854.md?page=2)
