create new android module lazarus / 43-Android ---------------------------------------------------------------------- m4u_hoahoctro · 2015-03-29 09:17 I have android module 1 and android module 2, and in android module1, i put a button and add this code: uses... unit2; ... procedure TAndroidModule1.jButton1Click(Sender: TObject); begin   androidmodule2.show; end; When I test on my phone, I click on button and nothing happens, module 2 doesn't appear and then app auto closes Why ? And how to fix it thanks. ---------------------------------------------------------------------- jmpessoa · 2015-03-29 16:21 Hi m4u_hoahoctro, please, try: Code: [Select]  if(AndroidModule2 = nil) then   begin       gApp.CreateForm(TAndroidModule2, AndroidModule2);       AndroidModule2.Init(gApp);   end   else   begin     AndroidModule2.Show;   end; Thank You! PS. You can try open "AppTest1" Demo..... for more info .... ---------------------------------------------------------------------- m4u_hoahoctro · 2015-03-30 04:50 what is "gapp" ? ---------------------------------------------------------------------- jmpessoa · 2015-03-30 05:17 gApp -->> Global [Pascal Android] Application .... ---------------------------------------------------------------------- m4u_hoahoctro · 2015-03-30 10:53 if(AndroidModule2 = nil) then   begin       gApp.CreateForm(TAndroidModule2, AndroidModule2);       AndroidModule2.Init(gApp);   end may this code mean if I don't have androidmodule2, it will create it ? ---------------------------------------------------------------------- m4u_hoahoctro · 2015-03-30 14:14 and I also have a prolem if code as this: both modules display in time how can i hide module1 ? and only show module2 ? if(AndroidModule2 = nil) then   begin       gApp.CreateForm(TAndroidModule2, AndroidModule2);       AndroidModule2.Init(gApp);   end else   begin     androidmodule1.Close;     AndroidModule2.Show;   end; ---------------------------------------------------------------------- jmpessoa · 2015-03-30 14:23 @m4u_hoahoctro Quote...I have android module 1 and android module 2, and in android module1, i put a button and add this code: uses... unit2; So, I understood that you had androidmodule2, if not then you need to create it: Lazarus IDE -->> File -->> New... -->Module --> Android DataModule Now You can use this code to create/initizalize [or show]: Code: [Select]  if(AndroidModule2 = nil) then   begin       gApp.CreateForm(TAndroidModule2, AndroidModule2);       AndroidModule2.Init(gApp);   end   else   begin     AndroidModule2.Show;   end; ---------------------------------------------------------------------- jmpessoa · 2015-03-30 14:30 Quotehow can i hide module1 ? and only show module2 ? 1. Set module2 BackGroundcolor <> transparent/default ! 2. Set molule2 ActivityMode = actRecyclable Do not close module1 [actMain] by code! Thank you! PS 1. Please, use the new wizard entrypoint "JNI Android Module (GUI)" to create new project... PS 2. I just now renamed the old entrypoint to "JNI Android Module (not GUI)" [under devolopment!] ... Sorry ---------------------------------------------------------------------- m4u_hoahoctro · 2015-03-31 14:25 thanks, but I think i also use code androidmodule1.finish;