08-25-2012 07:41 AM
I want to download some files(e.g. Image files or Mp3 files or video files) from a URL Link and store those files to SD Cards.
But I didn't find any codes related to solve my problem.
Please Help me if any one done such work or having any solution regarding to this Problem.
08-26-2012 10:26 AM
Using QNetworkAccessManager you can download what you want...
08-27-2012 01:48 AM
Is there any possible way for Cascades code not for QT.
I want the code for Cascades.
Please help me...
08-28-2012 11:55 AM
QNetworkAccessManager is documented in https://developer.blackberry.com/cascades/referenc
You are also interested in QNetworkRequest, QNetworkReply, and possibly XMLHttpRequest.
Some related threads:
As for saving data:
08-28-2012 03:15 PM
BTW, there are some new samples published.
Download all samples: git clone https://github.com/blackberry/Cascades-Samples.git
Import into momentics:
File/Import, git/projects from git (next), double-click local and add a local directory (next), select local directory and select all projects (default is select ones that aren't in your workspace)
Check out HttpTestSample and MultithreadingCallbacks102
The latter sample demonstrates how a call is made to perform a network operation to download an image and display it in the UI.
The image download uses QNetworkAccessManager and QNetworkReply with slots and signals to handle the download callback. See method "void LoadImage::load(QString imageUrl)"
After downloading "void LoadImage:nReplyFinished()" has the code to extract the bytes downloaded and stores it in a byte array.
QImage::loadFromData() loads the bytes downloaded into a QImage object.
To show it in the UI see the following method "void App:nImageLoaded(QString url, bool success, QString response)"
QImage is loaded into a bb::cascades:ixelBufferData, and bb::cascades::Image() is used to load the PixelBufferData.
Finally ImageView::setImage() is called with the updated bb::cascades::Image object to display it in the UI.
08-29-2012 09:56 AM
You can navigate to this page right off the main documentation page https://developer.blackberry.com/cascades/!
Press Documentation, scroll down, and press Networking.
09-26-2012 08:15 PM
Hi, i browsered the code on the site and there is not such one anymore, do you happen to have it? or any other site where i can download it¿
07-11-2013 07:31 AM
Use the following code. Its working for me.
image = image.scaled(768, 500, Qt::KeepAspectRatioByExpanding);
const QImage swappedImage = image.rgbSwapped();
const bb::ImageData imageData = bb::ImageData::fromPixels(swappedImage.bits(
in the above code "buffer"is instance of QByteArray. Convert inputstream to QByteArray and use above code.