[SOLVED]Anyone knows how to launch a second jform? lazarus / 43-Android ---------------------------------------------------------------------- amartitegui · 2017-12-18 17:10 To "show a second jform... It should be made by launching activity I guess.. but how should the activity be called an referred? Thanks to anyone knowing ---------------------------------------------------------------------- jmpessoa · 2017-12-18 19:23 Hello  amartitegui! there are more multi-form demo..... but go to "......demo\GUI" and look fot  "AppTest1"   a multi-form demo example.... now, to start  a new activity look for "intents" demos .... ---------------------------------------------------------------------- amartitegui · 2017-12-19 16:44 I've checked. launching second form works great. but i found a problem ...  if trying to close second form (to go back to mainform). Result is app has found a problem and will be closed. I do this to launch:         if(id_detail= nil) then           begin             gApp.CreateForm(Tid_detail, id_detail);                      id_detail.SetCloseCallBack(gps_sgtl_droidJNIPrompt, Self);             id_detail.PromptOnBackKey:= False;             id_detail.Init(gApp);           end                  else           begin             id_detail.Show;           end;            also:       procedure Tgps_sgtl_droid.gps_sgtl_droidJNIPrompt(Sender: TObject); begin   preparagrid;   text_search.Text:=''; end;                      Ideas? thanks ---------------------------------------------------------------------- amartitegui · 2017-12-19 17:35 I'm a little confused about why this can happen.... I mean.... the SetCloseCallBack really is just an event handler rigth? therefore It shouldn't even be necessary. I tried to remove it like this:   if(id_detail= nil) then           begin             gApp.CreateForm(Tid_detail, id_detail);                      id_detail.SetCloseCallBack(gps_sgtl_droidJNIPrompt, Self);             id_detail.PromptOnBackKey:= False;             id_detail.Init(gApp);           end                  else           begin             id_detail.Show;           end;             So I was thinking that just by closing form should do. But same problem. I'm I missing something? jmpessoa,  probably u know best thanks for any help ---------------------------------------------------------------------- jmpessoa · 2017-12-19 18:30 If you need only launcher a second form and not need a form result after close it... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if(id_detail= nil) then           begin            gApp.CreateForm(Tid_detail, id_detail);                       id_detail.Init(gApp);          end                   else          begin            id_detail.Show;          end; ---------------------------------------------------------------------- amartitegui · 2017-12-19 18:55 thanks jmpessoa. I just tried.... but same. the launching its inside a procedure like this: try         if MySQL56Connection1.Connected then begin           SQLQuery1.close;           SQLQuery1.sql.text:='HERE A QUERY';           SQLQuery1.active:=true;           SQLQuery1.Open;           with id_seleccionado do           begin                           {GETTING VALUES FROM  QUERY}           end;           SQLQuery1.Close;           if id_seleccionado.material_suelto=false then begin            {ASIGNING OTHER VALUES}                  if(id_detail= nil) then           begin             gApp.CreateForm(Tid_detail, id_detail);                    id_detail.Init(gApp);           end           else           begin             id_detail.Show;           end;                  id_detail.user:=MySQL56Connection1.UserName;           id_detail.pasword:=MySQL56Connection1.Password;            id_detail.popula_id(id_seleccionado);           id_detail.popula_puerta(puerta_rescatada);           end           else begin              ShowMessage('Material Suelto. Esta visión no está imprementada todavia. ')           end;            end;      finally      end; when It closes.... what does it really do. I mean. I guess that there is a problem when closing second form. or maybe when getting back to mainform. What's supposed to do when closing form... ? Its just to know if There is some data lost somewhere. (any variable that I may pass to a class in  {ASIGNING OTHER VALUES} ) or something. 'cause I dont really imagine why this may happen thanks ---------------------------------------------------------------------- jmpessoa · 2017-12-19 19:45 here you launcher form id_detail: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if(id_detail= nil) then          begin            gApp.CreateForm(Tid_detail, id_detail);                     //Edited <<---- here you can initialize some form public property ...          id_detail.Init(gApp);    //<--- this will triger "OnJNIPrompt"  in id_detail form          end          else          begin            id_detail.Show;          end;         So, try move this code to  "OnJNIPrompt"  in id_detail form ... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i           id_detail.user:=MySQL56Connection1.UserName;          id_detail.pasword:=MySQL56Connection1.Password;             id_detail.popula_id(id_seleccionado);          id_detail.popula_puerta(puerta_rescatada); ---------------------------------------------------------------------- amartitegui · 2017-12-19 20:04 Thanks man. Will tray that ---------------------------------------------------------------------- amartitegui · 2017-12-20 16:06 Well Didnt work. And this is what I found.... dont know why. I started new project. with same elements. And put a button to go to second form. And step by step adding components and see. The problem looks that its because jGridView. FIRST STEPS I got 2 jGridViews. I dont do anything to the gridviews. just placed in dessign. no data in them... nothing. Forms, both just with controls (graphic) and some variable declarations. When hitting button opens second. and when clicking BACK comes to main again Using:  procedure TAndroidModule1.jButton1Click(Sender: TObject); begin     if(AndroidModule2= nil) then     begin       gApp.CreateForm(TAndroidModule2,AndroidModule2);       AndroidModule2.Init(gApp);     end     else     begin       AndroidModule2.Show;     end; end; SECOND STEP: in JNIPrompt I make a call to :preparagrid I set in main form: procedure TAndroidModule1.preparagrid; var   row,col:integer; begin    with jGridView2 do begin        Clear;        ColCount:=8;        row:=0;        jGridView2.AddRow(row);        jGridView2.Cells[0,row]:='ID';        jGridView2.Cells[1,row]:='PEDIDO';        jGridView2.Cells[2,row]:='CLIENTE';        jGridView2.Cells[3,row]:='REF CLIENTE';        jGridView2.Cells[4,row]:='SERVIDA';        jGridView2.Cells[5,row]:='FORR HOJA';        jGridView2.Cells[6,row]:='FORR BASTI';        jGridView2.Cells[7,row]:='MAT SUELTO';    end; end;         AND FAILS. so, what I have to do is set a boolean variable (grid_set_enable) set to false at activitycreate and in JniPrompt if its false I call preparagrid, and then set it to true. NOW it works.