• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How to generate 5 Image objects or Buttons using code (maybe Java) in Tasker?

darkpixie

Lurker
When creating for example image by code, there is some code snippet inside. I wanted to replace the x position in there with variable PosX, which I would like to set beforehand. Unfortunately the code does not recognize nested variables.

What I wanted to achieve is some kind of a line made from images in form of rectangles automatically after I click the button or start a task.

I would like to set the distance between rectangles as well as their size, but Tasker is so mysterious with the nested Java code for image and variable PosX and PosY don't work inside.

Any ideas?
 
Dear Thom,

I think I mastered manually alot of things, but as You know, when creating manually some Button gives code in form of Java I think in the Content, in which I replaced x position with PosX variable, but unfortunately for me, even Variable Set for PosX to 100 before the creation of a button, even with time interval of 1 second, is not recognized.

Can object content include variables predefined? How?

Should I take all content before and after into " like this:

"contentbefore"+%PosX+"contentafter"

or maybe there is no way at all?

thanks again
 
When I click the button, Element -> Create makes 2 buttons. Every field in each or those 2 button has this standard code with which I would like to interact, but I dont know how to pass variables to it:


<ImageElement sr=""ve="2"><RectElement sr="background"><Str sr="arg0"ve="3"/><Int sr="arg1"val="0"/><Str sr="arg2"ve="3">#FFFFDB00</Str><Str sr="arg3"ve="3"/><Int sr="arg4"val="0"/><Str sr="arg5"ve="3">#FF000000</Str><Int sr="arg6"val="0"/><Int sr="arg7"val="0"/><geom>-1,-1,-1,-1,-1,-1,-1,-1</geom><flags>4</flags></RectElement>
<Str sr="arg0"ve="3">tetris02</Str><Img sr="arg1"ve="2"/>
<Int sr="arg2"val="255"/><Str sr="arg3"ve="3"/>
<geom>-1,-1,-1,-1,300,100,150,60</geom><flags>4</flags></ImageElement>

I want just to replace the 300 in the last line geom, which is x position to a variable %PosX for example. I tried already %PosX and %%PosX and even 'PosX'. Nothing works yet.

PosX is set before creation, but the number doesn't go to the content of the buttons. I am not familiar with Java.

Thats what I meant.

Moreover, I have another problem, which I cannot solve and its pretty similar. I did another code and instead of interacting with Content like above, I moved buttons using Element -> Position, but first click creates both buttons, just the second click moves them together.
 
I'm trying to create just a simple 2 button prompt to ask if it should turn on Mobile Date On / Off buttons..
 
Back
Top Bottom