Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
mistermentality
Old
#1  
Senior Member - OP
Thanks Meter 244
Posts: 1,409
Join Date: Sep 2010
Location: Pontypridd
Question [Q] Can app inventor apps write or read text to /from sd card?

I have been writing an app with app inventor, for my own use but I think it could be of use to others. It is very simple, you type in a cosmetic or a food ingredient name and it tells you all about it (for example if the ingredient has any negative health effects or contraindications).

Currently the app takes an input and essentially does an IF the user typed in "this text" then show them "this text" but that means a lot of IF THEN commands.

I only ever tried BASIC programming and I see that app inventor seems to have no equivalent to a file or write command whereby I could store the database of ingredients on the sd card and search that for information to display to the user.

As it stands the app is nearly five megabytes in size already due to having to store its data internally within the program, is there a way a newb like me could use app inventor to simply search from and display from a text file?

Dave
 
nemoc 23
Old
#2  
nemoc 23's Avatar
Junior Member
Thanks Meter 0
Posts: 17
Join Date: May 2009
Location: Greece
why don't you use a database (TinyDB) instead of all those IF.

Try looking at this tutorial

Code:
http://appinventor.googlelabs.com/learn/tutorials/textgroup2/textgroup2.html
 
mistermentality
Old
(Last edited by mistermentality; 21st January 2011 at 09:20 PM.) Reason: additional information
#3  
Senior Member - OP
Thanks Meter 244
Posts: 1,409
Join Date: Sep 2010
Location: Pontypridd
Thank you

I looked into tinydb, I understood it had a limited entry limit and didn't see the page you linked to when searching before so will study that as it looks like what I may need.

I have one question though, I am a newb so excuse me if this is obvious.

I am writing the app using the emulator to test it. As I understand it the tinydb database is only accessible by the app that creates it and so my app will need a routine in it where I can manually enter the data, but then surely each time I test run it I shall have to re enter all that data as apparently the emulator would wipe the database on each re run?

If tinydb cannot store data unless entered from within the program accessing it doesn't that also mean that when packaged the database would be empty until someone typed in data which would defeat the object of it being a searchable database of pre stored data?

Dave

EDIT: According to google developers at googles forum "TinyDB is persistent ONLY when you've packaged and downloaded your app.
When you are developing with the phone connected, and you quit the appinventors app -- or disconnect the phone and restart -- the phone treats that as a completely new application. " which means that the only way to get my data into tinydb file is enter it when packaged and on my phone. But then every user who installed it would have an empty database, so seems canonly use those if then statements after all
 
Archer
Old
#4  
Archer's Avatar
Forum Moderator / Recognized Developer
Thanks Meter 2919
Posts: 12,253
Join Date: Jul 2008
Location: Northampton
I've never used app inventor, so I'm not talking from experience here, but couldn't you package an XML file with the data in it? That way, future updates to the data could simply include an enhance XML file.

Like I said - I don't know app inventor. It's just a thought.
.
"I live by my own rules, nobody else's, not even my own."
.
Hide Folders | PLToggle | WifiNoStandby | CHTEditor | XDA Toolbar
.
My xda links

New User Guide | XDA Forum Rules | 10 Posts - Why and How? | Admins & Mods | My xda Bookmarks

.
 
mistermentality
Old
#5  
Senior Member - OP
Thanks Meter 244
Posts: 1,409
Join Date: Sep 2010
Location: Pontypridd
Thanks to the replies here, along with some help and examples at the google groups coffee shop forum, I found the information I need that should enable me to set up a custom tinywebdb database and on first run of the app populate this data from there into a local tinydb database for subsequent use

Dave
 
ptvtpc
Old
#6  
Junior Member
Thanks Meter 1
Posts: 7
Join Date: Oct 2007
If you have a link, Dave, then share it. I need some info on the tinydb too.
 
mwaychoff
Old
#7  
Junior Member
Thanks Meter 2
Posts: 16
Join Date: May 2010
Location: Pittsburgh
I'm in the same boat hear, do you happen to still have a link for any info you obtained on this Dave?
 
Droidzone
Old
#8  
Droidzone's Avatar
Recognized Developer
Thanks Meter 2059
Posts: 5,454
Join Date: Sep 2010
Location: Kerala

 
DONATE TO ME
This explains everything:
http://appinventorapi.com/program-an-api-python/

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Preventing App Piracy: Join the Discussion

The topic of piracy is always a touchy subject, but I feel that the grass roots style of Android … more

Jolla Sailfish OS Flagship Device Makes First Appearance

Given the amount of coverage that Android receives around here, you could almost be … more

XDA University: Porting ClockworkMod Recovery to New Devices

Having a good recovery makes the process of modifying, tweaking, maintaining, … more

One Stop Guide Shop for the Newbie and Dev

It’s been well established that XDA-Developers isthedestination for resources relating to … more