Only button EXECUTE_B appears in the DroidScript.

Asked 2 years ago, Updated 2 years ago, 371 views

ボタンTwo buttons.How do I display EXECUTE_A and EXECUTE_B?
②Please tell me how to pass the new Date arguments at once.
Thank you for your cooperation.

(Reference) roDroidScript

https://qiita.com/YasumiYasumi/items/832ec009681310ecdd1c

(Reference)
https://ja.stackoverflow.com/questions/72296/echo Output - Pipe - File Output and Clipboard Continuous /72333#72333

 function OnStart() 
{ 
  lay=app.CreateLayout("linear", "VCenter, FillXY"); 
  btn=app.CreateButton("EXECUTE_A", 0.4); 
  btn.SetMargins(0,0.05,0,0); 
  btn.SetOnTouch(btn_OnTouch_A); 
  lay.AddChild(btn); 
  app.AddLayout(lay); 

  lay=app.CreateLayout("linear", "VCenter, FillXY"); 
  btn=app.CreateButton("EXECUTE_B", 0.4); 
  btn.SetMargins(0,0.05,0,0); 
  btn.SetOnTouch(btn_OnTouch_B); 
  lay.AddChild(btn); 
  app.AddLayout(lay); 

} 
function btn_OnTouch_A() 
{ 
  myDateTime = new Date()
  myDateTime=myDateTime.toLocaleString("ja")
  app.ShowPopup(myDateTime+"myA"); 
}
function btn_OnTouch_B() 
{ 
  myDateTime = new Date()
  myDateTime=myDateTime.toLocaleString("ja")
  app.ShowPopup(myDateTime+"myB"); 
}

javascript android

2022-09-30 21:51

1 Answers

As for the partial answer, I think the reason for the first one is that both buttons are replaced by the common lay, btn.

You should assign distinguishable names, such as btnA and btnB.


2022-09-30 21:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.