Is there a way to access android.app.Activity or android.view.View objects in Java functions?

31 views
Skip to first unread message

Zoltan Fazekas

unread,
Aug 19, 2016, 2:10:13 AM8/19/16
to Tasker
Hi,

I call Java functions in my Tasker app using the CONTEXT object as startng point. However, this is an instance of android.app.Application and in several cases I would need an instance of android.app.Activity, e.g. to access the android.view.View object associated with my scenes calling findViewById() on the Activity object. Is there a way to access the Activity and get to the View somehow?

Thanx in advance
Regards
Zoltan

Pent

unread,
Aug 25, 2016, 5:08:32 AM8/25/16
to Tasker

I call Java functions in my Tasker app using the CONTEXT object as startng point. However, this is an instance of android.app.Application and in several cases I would need an instance of android.app.Activity, e.g. to access the android.view.View object associated with my scenes calling findViewById() on the Activity object. Is there a way to access the Activity and get to the View somehow?

Sorry, no.

All tasks execute in a service from where the Activity object associated with a
particular scene is not easily accessible. Obviously it would be possible, but
there are some tricky problems associated which I prefer not to risk.

Pent
Reply all
Reply to author
Forward
0 new messages