Recent

Author Topic: assets folder: how do i access?  (Read 2538 times)

OldSchoolProgrammer

  • Newbie
  • Posts: 3
assets folder: how do i access?
« on: July 25, 2015, 04:53:48 pm »
By reading another topic (here at the forum)...
I found out how to add assets to my apk.
(LOL... it was surprisingly easy)

But I've searched long and hard trying to find
out how to access those text files and
could not find an answer.

I would have thought this question
would have been answered long ago.
Especially when you consider... assets
are one of the basic needs of most
Android programmers.

I suspect it has something to do with the...
 asset_manager.pas
(folder: laz4android\lcl\interfaces\customdrawn\android)
But since I'm new to Lazarus... I'm clueless
as to what to do with this file.

background: I have extensive knowledge in the Basic
programming language (and virtually all it's dialects).
One of which was a cross between Visual Basic and
Delphi.

Anyways... what would be nice is... if one of the experts here,
at this forum, replied with a detailed example of how to access
the assets folder, so that everyone could benefit from.

Thanks In Advance
Don't you wish LIFE was as simple as... writing source code?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: assets folder: how do i access?
« Reply #1 on: July 29, 2015, 04:11:37 pm »
Which way of writing Android apps are you using? LCL-CustomDrawn or something else?

OldSchoolProgrammer

  • Newbie
  • Posts: 3
Re: assets folder: how do i access?
« Reply #2 on: July 31, 2015, 11:06:14 pm »
Yes, sir, I am using the LCL-CustomDrawn.

I created an empty form (copied from the android example).
I added one TStringList, two TButtons, and one CDEdit.

The first TButton is suppose to read in a simple "plain text" file from the assets folder (via the TStringList) and display that text file in the (multiline) CDEdit.
The second TButton is for exiting the app cleanly (terminating it instead of simply hiding it).

On a side note... I noticed the CDEdit does not have "swipe to scroll" capabilities.
What I mean is... I "manually" added a large amount of text to the CDEdit and was not able to scroll thru it by swiping.
I was able to navigate via the keyboard, but that is very annoying.
I also tried using a TMemo, but was not able to add/append ANY text to it.

On another side note... I came across the Pascal4Android which "seems" to have the ability to access the assets folder but it also "seems" it have very limited components.
Don't you wish LIFE was as simple as... writing source code?

 

TinyPortal © 2005-2018