01-24-2014 08:54 AM
I am a new developer.
Before I begin sorry for the large number of questions.
Well I did not put these questions only after many attempts to find Answers, But all my attempts failed.
Q1: What is the best and fastest Xml or Json in blackberry?
Q2: How to make automatic update of the data when the application runs?
Q3: How to safe data in device then displayed again when run the application? ( Don't download the data again from Service ).
Q4: How to create pull to refresh data?
I have seen many examples, and it was the best application weatherguesser.
But use c ++
01-24-2014 09:44 AM - edited 01-24-2014 09:45 AM
Hi! Welcome to the forums. Please create one thread per question, it will be easier to discuss them or search for them later.
For parsing XML and JSON there are XmlDataAccess and JsonDataAccess classes. If their functionality is sufficient, I'd try using them first. Performance is not critical unless you're working with really large data arrays. There are also classes for parsing XML in Qt (QXmlStreamReader etc), but I suggest trying BB ones first.
There is also higher level DataSource class which can load JSON or XML as well, even from remote source. It can be used from QML. It uses XmlDataAccess & JsonDataAccess internally.
2) For QML, there's DataSource class. After loading and parsing the data, populate the model. This page has some sample code:
Optionally, cache the data in a local database.
In C++ QNetworkAccessManager + QNetworkRequest classes can be used.
3) For saving user settings - QSettings. It stores them in a text file. Not recommended for large data sizes.
For saving large data arrays - sqlite database.
Big files such as images can be saved directly to disk.
All this caching has to be implemented manually.
Another option is downloading the data from webserver and saving the response "as is", then parsing it when the app starts.
If the data is large and delay during parsing is noticeable, the parsing can be done in a separate thread to not block the UI.
4) Pull to refresh: have you seen this thread?
(I haven't tried using this control.)
QML is designed mostly for describing interfaces in declarative way. Most complex things in application logic are easier to do in C++ (or even impossible in QML with current set of libraries), so investing time into learning C++ is much recommended.
01-24-2014 09:48 AM
Welcome to the forums.
The problem with putting lots of questions (even if related) in the same thread is that it's a lot of effort needed to answer which will put some people off. Secondly if someone only knows say an answer to two of the questions they will feel uncomfortable not being able to answer the other two.
Thirdly it always ends up as an unwieldy long conversation with tens of posts, which some will then just look at the post count and think I can't be bothered to get in on that too much reading.
So for your benefit keep threads to one question only.
FYI I could answer all of these but I'm thinking I will get bogged down in the thread and not be able to do my own work, most of us will just want to fire off a quick, hopefully helpful, response. So my advice keep to one question per thread and put a bit more meat on the bone with the background behind why you are asking the question as well.
01-24-2014 09:49 AM - edited 01-24-2014 09:49 AM
01-24-2014 10:04 AM
01-24-2014 10:49 AM
I like JSON, because XML is dumb!
Really, either works. I find JSON to be easier to create and parse, but it's up to you. If you have data that is already in one format or the other I'd just use that, really the system takes care of it for you.
I would also recommend trying to use Push whenever possible. If you can structure your app so data is pushed down to the device whenever there is something new, it will make the app feel much faster and more responsive without having to download new data every time the app starts.
For storing the data, you can just write XML or JSON out to your app's private sandbox in the file system. You could also convert it into SQL or something and store it in a SQLite database. Depends on the the data and what you are doing with it, really.
01-24-2014 07:01 PM - edited 01-24-2014 07:20 PM
Hello Zmey, BBSJdev, simon_hain and PBernhardt.
Thanks for helping me
And sorry again to the questions.
I've used the example of "bb10pulltorefresh" there is a problem.
I will be writing a new topic.
I will write a new topic for each problem.
Sorry can you clarify that?
Me too I like Json.
It's really good.
It is also the best and easiest to create in PHP
My new topic:
01-27-2014 03:54 AM