Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Posts: 1
Registered: ‎12-31-2010
My Device: Not Specified


Hi All,


I'm working on a data based app and am using the built in SQLite to work with the data. I'm new to app development, and am having trouble passing the data between the database and the GUI. I'm using Flash Builder 4.5 to build the app as a flex mobile project using mxml views as the GUI. I have gone through a few tutorials, the Blackberry Playbook webcasts and searched through the forum for additional suggestions of how to build this. I would love any suggestions that anyone has on resources I could use to help me understand how to do this or if you have suggestions based on the code below. 


A few examples of what I am trying to do:

I have an AS file called "ListDAO" that builds the database and holds the queries I am trying to reference. An example of one is:


 public function categoryList()Smiley Very HappyataProvider
 var sqlSmiley Frustratedtring = "SELECT categories FROM tblGList GROUP BY categories";
 var stmtSmiley FrustratedQLStatement = new SQLStatement();
 stmt.sqlConnection = sqlConnection;
 stmt.text = sql;
 var result:Array = stmt.getResult().data;


I already have the other code written that creates the database if there isn't one and populates the table with sample data if it is empty.


From there, I try to access these data results in my mxml file with the following code (I also import model.ListDAO at the top of the file):



 <s:List width="100%" height="100%" dataProvider="{ListDAO.categoryList()}" labelField="categories"/>



but that just gives me an error.


From there I want to take the results of the selection in the list and pass it back to the database for a different query. I know I can use click="navigator.pushView(viewname,list.selectedItem)" within the list to get me to the next view, but how can I also pass that list.selectedItem back to my ListDAO as the criteria for the query I want to use in that view.




Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: SQLite

[ Edited ]

Couple of quick things I see:


1) The function categoryList, is not returning anything.  You probably need to add:


return new DataProvider( result );


2) If you are getting a compile error in the MXML, it might have to do with the class needs to be "Bindable".


Hope that helps in part.