0 vs NULL :-)

KMatle

Expert
Licensed User
Longtime User
Unbenannt.JPG
 

KMatle

Expert
Licensed User
Longtime User
in the Starter service

Please notice that you have to initialize the Toilet object as ToiletPaper is a member of Toilet. Your can use it like this:

B4X:
Toilet.Initialize("SmallJob")

or

B4X:
Toilet.Initialize("BigJob")

"BigJob" reserves more toilet paper. I mostly use this option as it returns unused paper automatically.

The PeeOnly method has been removed for security reasons.

After that you can use

B4X:
Toilet.ExecuteSingleJob

and finally

B4X:
Toilet.FinishSingleJob
Toilet.ToiletPaper.Use
Toilet.Flush 'Important!!!!!

Hint: You can call the "use" method multiple times if needed :) The ExecuteMultiple option is only available in special situations (call your doctor then). You need to add the "ExecuteMultiple" permission manually.

Please take care to set the energy saving options correctly. Otherwise your toilet app will be stopped when the screen turns off which may cause unwanted and embarrassing situations. Change the package name to a non-offending one and put the volume to a discreet level.

Have fun! :)
 

ilan

Expert
Licensed User
Longtime User
Cool thanx for the explaination.
I have only 1 more question. How can i know when the Toilet.bigjob has finished?

Is there a toilet_finish(arr() as object) event?

Thanks, ilan
EDIT: can you maybe also add a toilet_inprogress event so i can show the progress with a progressbar?
 

JordiCP

Expert
Licensed User
Longtime User
In order to avoid using DoEvents, I'd better wait for the Toilet_JobDone event and test if Success is True

B4X:
Sub Toilet_JobDone(Success as Boolean)
  if Success Then
    Toilet.ToiletPaper.Use
    Toilet.Flush 'Important!!!!!
  Else
    ToastMessageShow("Oops. Sorry for that!")
  End if
End Sub
 

ilan

Expert
Licensed User
Longtime User
In order to avoid using DoEvents, I'd better wait for the Toilet_JobDone event and test if Success is True

B4X:
Sub Toilet_JobDone(Success as Boolean)
  if Success Then
    Toilet.ToiletPaper.Use
    Toilet.Flush 'Important!!!!!
  Else
    ToastMessageShow("Oops. Sorry for that!")
  End if
End Sub

I tried it but i get an error :(
What am i doing wrong???

Please hurry this is argent !!

* Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (menu) Create, isFirst = false **
** Activity (menu) Resume **
Toilet.intialize
Toilet.paper.soft = true

callsubutils_BigJob_tick (java line: 181)
java.lang.NullPointerException: Attempt to read from field 'boolean www.sagitalcashlite.net.callsubutils$_rundelayeddata.Delayed' on a null object reference
at www.sagitalcashlite.net.callsubutils._tmr_tick(callsubutils.java:181)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.objects.Time$bigjobTick.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
 
D

Deleted member 103

Guest
Please turn off the speaker, otherwise it stinks. :D
Toilet.speakerOff = true
 

udg

Expert
Licensed User
Longtime User
I loved this thread from first post to the last one.
Hilarious is the word that comes to mind.

Thank you all
 
D

Deleted member 103

Guest
Permission
No special permission is required for "SmallJob" and "BigJob"
Only for "SexJob" is root-permission necessary!
 

Beja

Expert
Licensed User
Longtime User
The following code in service
B4X:
If EndOfPaper THEN
     FeedNewRoll
END IF
You need B4R and Arduino for the autofeed mechanism.

This will prevrent the null condition.
 
Top