Intent extra expecting an ArrayList<string>

248 views
Skip to first unread message

lakeside

unread,
Mar 8, 2016, 4:09:21 PM3/8/16
to Tasker
I am trying to pass an ArrayList object to an intent extra. Here are my current steps:

1 ) Create an ArrayList<string> object called form_ids_list.
2) 
Populate form_ids_list via form_ids_list .add("form1") and form_ids_list.add("form2")
3)  Call the intent com.myapp.android.external.FORCE_FINALIZATION with the extra FORM_IDS_LIST_EXTRA:form_ids_list

Is the ArrayList an appropriate object to pass to an extra?
If not, if "myapp" is expecting an ArrayList<string> object, can I still use Tasker and extras with this intent? The Tasker Intents documentation indicates Java objects can be passed in as extras if they are parcelable. I realize if I knew Java I would probably know the answer to this. :)

For the record, the intent works without the extras - it just acts on all "forms".

lakeside

unread,
Mar 8, 2016, 4:20:16 PM3/8/16
to Tasker

I believe I answered my first question. Namely that ArrayLists are not parcelable. Does this mean I cannot pass extras to this intent with Tasker?

From the log:

08-03-2016 E: 15.33.30#E: exe: Encrypt / Send Intent [ Action:com.myapp.android.external.FORCE_FINALIZATION Cat:None Mime Type: Data: Extra:FORM_IDS_LIST_EXTRAS:form_ids_list Extra: Extra: Package: Class: Target:Activity ]
08-03-2016 JU: 15.33.30#JU: analyse: Send Intent: form_ids_list expected: null
08-03-2016 JU: 15.33.30#JU: Send Intent: analyse done: form_ids_list: class: java.util.ArrayList  obj: [form1, form2] partWithoutMods: null static: false const false casted: false
08-03-2016 E: 15.33.30#E: attempt to put java object as parcelable (class java.util.ArrayList)
08-03-2016 E: 15.33.30#E: warning: Send Intent: Java object extra: class java.util.ArrayList not parcelable

YT

unread,
Mar 17, 2016, 4:33:35 AM3/17/16
to Tasker
did you get anywhere with this? i would also like to pass a parcelable object via an intent extra to another app using Tasker, but could not figure out a solution

Juergen Gruen

unread,
Mar 17, 2016, 7:01:10 AM3/17/16
to Tasker
Hi,

you can create a Bundle-object (implements parcelable) with Java Function:

Bundle (92)
A1: Java Function [ Return:bundle Class Or Object:Bundle Function:new
{Bundle} () ]
A2: Java Function [ Return: Class Or Object:bundle Function:putString
{} (String, String) Param:myString Param:Hello World! ]
A3: Java Function [ Return: Class Or Object:bundle Function:putInt
{} (String, int) Param:theAnswer Param:42]
A4: Send Intent [ Action:myapp.Test Cat:None Mime Type: Data: Extra:myBundle:bundle Extra: Extra: Package: Class: Target:Broadcast Receiver ]

Juergen.

Wern-Yuen Tan

unread,
Mar 17, 2016, 7:35:38 AM3/17/16
to tas...@googlegroups.com
Thank you, will try this out tonight. I am trying to send a startservice intent rather than a Broadcast. Specifically, here is the intent I want to send (in the form of a shell command):

am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.NotificationSenderService --es "sender" "com.google.android.gm" --es "message" "%antitle: %antextsbig4" -e "dismiss_key" myBundle

I've tried putting the package name under "package" and service under "class" but it's not working for me. Any suggestions? Thanks!





Juergen.

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/jm1xkn9qSiM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages