0

It says exactly this. I don't think I made a mistake. Here is my code:

function OnStart()
{
 list=app.LoadText("List");
lvw= app.CreateListView(list,"Lego");
 
 lvw.SetOnTouch( lvw_OnTouch );
 lvw.Show();
 }
 app.EnableBackKey( "false" );

 function lvw_OnTouch( item )
 {
if(item=="Add Item"){
to=app.LoadText( "List" );
//Create dialog window.
dlgTxt = app.CreateDialog( "Add Item" );  
//Create a layout for dialog.
layDlg = app.CreateLayout( "linear", "vertical,fillxy,left" );
layDlg.SetPadding( 0.02, 0, 0.02, 
 0.02 );
dlgTxt.AddLayout( layDlg );
lstDlg = app.CreateTextEdit("");
lstDlg.SetHint( "*******Item ID  here*******" );
lstDlg.SetPadding( 0.0, 0, 0.02, 
0.02);
lstDlg.SetTextColor( "#dddddd" );
layDlg.AddChild( lstDlg );
lstDlg.SetOnEnter( enter );
 amount= app.CreateTextEdit("");
amount.SetHint( "*******Item Amount*******" );
amount.SetPadding( 0.0, 0, 0.02, 
0.02);
amount.SetTextColor( "#dddddd" );

layDlg.AddChild( amount);
amount.SetOnEnter( enter );
//Show dialog.
dlgTxt.Show();
}else if(item=="Reset"){
var yesno=app.CreateYesNoDialog("Do you really want to reset?");
yesno.SetOnTouch(yesnores);
yesno.Show();

}else if(item=="Exit App"){
app.Exit(  );
}else{
lvw.Show();
}
function enter()
{
dlgTxt.Hide();
lvw.Show();
app.SaveText("List",to+","+lstDlg.GetText()+"        "+amount.GetText());
}
function OnBack()
{
app.Exit(  );
}
function yesnores(result)
{
if(result=="Yes") 
{app.SaveText("List","Add 
Item,Reset,Exit App");
}else  lvw.Show();
}
}

I checked the code again and again but no result, I can't find what causes the error. Don't forget that is not javascript, that is DroidScript, that is different from javascript. The app needs to hold values they are coming from user when user hits Add Item, the list should be resetten when user presses Reset and the user should exit from the app with just one click to Exit App.

kahveciderin
  • 312
  • 1
  • 3
  • 22

2 Answers2

1

You have a line break in the middle of a string

This should be all one line

app.SaveText("List","Add Item,Reset,Exit App");
0

click on debug check what is happening it shows her the problem that is occurring

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Vikram Parimi Sep 07 '22 at 12:16