Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkeyIOS

Swipe Down To Refresh ListView With Delphi XE5 Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Pull Refresh | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Embarcadero has some sample code up which shows you how to do a pull or swipe down to refresh a TListView. A lot of mobile apps like Facebook use this functionality instead of having a refresh button. It saves screen real estate by not having an extra button to deal with. The idea is that you are at the top of the list and you put your finger down on the list and swipe or pull down. The list drags down and then you show a activity spinner above the list. Once the update is complete and the list gets updated the activity spinner goes away. The blog post talks about being for IOS but this will work on both Android and IOS. The code is simple enough and just checks the ScrollViewPos property of TListView. Take a look:
procedure TForm.ListView1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Single);
begin
if not Updating and (ListView1.ScrollViewPos < -40) then
begin
Updating := true;
AniIndicator1.Visible := True;
AniIndicator1.Enabled := true;
for
I := Myposition + 1 to Myposition +20 do
begin
LItem := ListView1.Items.Add;
LItem.Text := Format(’Text %d’, [I]);
end;
inc(myposition, 20);
end;
end;

You could combine this code with the TListView RSS viewer demo.

Check out the full blog post and example from Embarcadero.

Update: Download Delphi XE5 Firemonkey Pull To Refresh Demo for Android

close

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

DelphiIDEShowcaseWindows

Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores

DelphiFiremonkeyIDEIOSOSXWindows

DelphiCon 2020 FireMonkey Sessions Available Starting November 19

Sign up for our Newsletter and
stay informed

10 Comments

Leave a Reply to Admin Cancel reply