-2

I am working on a simple android app that uses sqlite. I have a simple multi device app. There is a list view connected to the fdquery1, and fdconnection1. When i compile to my android phone i get the black screen with fire icon. If i turn of the fdconnection1 then the app will compile(NO Data Display In Listview). Has anyone run into this before ? I am using Delphi Community edition. Thanks for your help. here is link to my sorcecode

The only code i have is for android.

procedure TForm4.FDConnection1BeforeConnect(Sender: TObject);
begin
   {$IF DEFINED(iOS) or DEFINED(ANDROID)}
    FDConnection1.Params.Values['Database'] :=
    TPath.Combine(TPath.GetDocumentsPath, 'flatrate.db3');
    {$ENDIF}
end;

I disconnected the fdconnection1 and connected it on the forms on show event. The app will now compile to android but I am having trouble exeacuting the query1 sql to show the data in the list view.

procedure TForm4.Button1Click(Sender: TObject);
  begin
    FDQuery1.SQL.Text := 'select * from main';
    fdquery1.ExecSQL;
    FDQuery1.Open;
  end;

When I click on the button on my android phone i get message "error no such table main"

grant1842
  • 357
  • 1
  • 7
  • 23
  • 1
    To debug this issue, copy your **flatrate.db3** to `C:\Users\\Documents` and compile the application for FMX Windows platform instead. I also suggest you set the `Active` property on the `FDConnection1` to `False` at designtime, and only set it to `True` on (for example) `FormShow`. – Freddie Bell Dec 29 '18 at 17:54
  • 2
    Please do not expect readers to download things from external sources. Your q should be self-contained and include all necessary source code to reproduce the problem. – MartynA Dec 29 '18 at 18:06
  • @ nolaspeaker That seem to help i connected it of form show. – grant1842 Dec 29 '18 at 22:31

1 Answers1

0

Well i am not sure how android phones handle cash but it seems that if i uninstall the app completely and then run my app it works.

procedure TForm4.FormShow(Sender: TObject);
 begin
   FDConnection1.Connected:= True;
   FDQuery1.Active:=True;

 end;

I hope this helps someone :)

grant1842
  • 357
  • 1
  • 7
  • 23