Alexiat

Your Rank: 71
Points: 23
I am baffled. This worked in XE7 but not in XE8. I put together a quick Android app that simply calls SaveFormState when the user hits the hardware back button and then reloads the state in FormCreate. It doesn't work in the FormSaveState either but this was a quick test. Can someone show me where I have gone wrong? When reading back in the file exists but it always has a size of 0. Thanks.
procedure TForm1.FormCreate(Sender: TObject);
begin
SaveState.StoragePath := TPath.GetHomePath;
LoadFormState;
end;
procedure TForm1.SaveFormState;
var
s: string;
W: TBinaryWriter;
begin
s := 'Save state test';
W := TBinaryWriter.Create(SaveState.Stream);
try
W.Write(S);
finally
W.Free;
end;
end;
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
begin
if Key = vkHardwareBack then
begin
SaveFormState;
MainActivity.finish;
end;
end;
procedure TForm1.LoadFormState;
var
s: string;
R: TBinaryReader;
begin
s := 'blank';
if SaveState.Stream.Size > 0 then //always is zero!
begin
R := TBinaryReader.Create(SaveState.Stream);
try
s := R.ReadString;
finally
R.Free;
end;
end;
memo1.Lines.Add(s);
end;
Read More...
I did and I cannot express enough how helpful they were. But I could not figure out the https issue and how to stop the REST Request Timed Out error message when uploading a file (so I could give something more meaningful). So I appreciate your help.
BTW, XE8 is amazing. The speed of the compiler is awesome. Our app is quite complex and before I had to constantly restart XE7 because of crashing, even after just changing a line of code. So such thing now. So whatever internal changes were made in XE8 have really made it a great development environment. So so happy I upgraded!
Read More...
I have XE7 on my computer. I installed XE8. When I launch XE8 after install I get multiple errors. The access error displayed happens when I close XE8 (I simply open XE8, receive the errors, and close XE8). I have installed twice and still happens. Solution? Thanks.
Errors XE8.png
Read More...
Any ideas yet Sarina? We really need to put uploading to Kinvey in a background task so we need to know if the task doesn't complete. And since it is going to be on a background task, the user could have moved on to a different window so a "REST Request Timed Out" message might be more than a little confusing to someone. Thanks again for any help you can give.
Read More...
In using Kinvey, I want to make sure all communications are done via https. It looks like the protocol for communicating with Kinvey defaults to https, but could someone tell me please how set the Kinvey Google Cloud Storage URLs to https? Right now my Backendfile1.Files.UploadFile() is returning an http url rather than a https url. I know this has to be simple and my brain has just temporarily left me... Many thanks.
Read More...
Just now getting back to this and I have tracked down the timed out error to when I upload a file. I am using the following code. Since I am using Kinvey it would be to the Google Cloud. I am using:
BackendFiles1.Files.UploadFile(filename,LStream,'application/json',LFile)
where LFile is a TBackendEntityValue and LStream is a TMemoryStream. Note that the file I am uploading is quite small.
From time to time, I am receiving a message saying the REST request timed out. Can you tell me how I can stop this message from showing up as it isn't particularly user friendly. I have a try-except clause around the UploadFile but it apparently doesn't get to that point.
Any help would be much appreciated.
Read More...
We have a rather complex tabbed mobile app where each tab can potentially create one or two other windows. Is this a good way to do this then and the window will be destroyed when no longer referenced or will this eat up a lot of memory? Should we check each time the window is used to make sure it has not been disposed of? Many thanks for your assistance.
Read More...
I realize this is probably a very basic question but hopefully someone can point out the obvious to me. If using Pawel Glowacki's "Lazy Form Creation Design Pattern" below, what is the correct way to release AFormMain?
Pawel's way seems like a good way to proceed if one is using quite a few windows in a mobile app such that they don't need to all be created unless needed. But I suspect releasing them incorrectly would cause problems, especially if a form might need to be called again after release. Many thanks.
type
TFormMain = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
function FormMain: TFormMain;
implementation
{$R *.fmx}
var
AFormMain: TFormMain;
function FormMain: TFormMain;
begin
if AFormMain = nil then
AFormMain := TFormMain.Create(Application);
Result := AFormMain;
end;
Read More...
Thanks Sarina. I am just using the basic Kinvey XE7 components but since I am new at this I will go over the examples you mention above again. If I continue to have this issue I will see if I can track it down specifically.
Read More...
I am using XE7. Sometimes when trying to retrieve information from the Kinvey Data Store I get a "REST request failed" message. Sometimes it says "timed out" and sometimes it says "closed gracefully". I have even had a Socket Error #107 and I have no idea what that is. And, when I try again a few seconds later all is well. I know I am connected to the Internet with high speed access at the time. Since this request is done through XE7 and usually works is this just something I need to constantly check for? I know very little about this so was hoping someone could shed some light on the issue for me. Thanks.
Read More...
Thank you very much....
I am using Kinvey with XE7. I have found that when uploading files (BackendFiles.Files.UploadFile()) it can sometimes take a few seconds to complete which, in mobile, is quite noticeable. A slow server would amplify this delay. I am VERY new to threading but am intrigued by ITask. Is it a really bad idea to save a file in the background this way? I...