Loading of the URL image

I'm new to Blackberry 10 development and I am trying to load an image from the web in a ListView of ImageView control.

My QML for ListView looks like this:

ListView {
    id: titlesListView
    objectName: "titlesListView" 

    listItemComponents: [
        ListItemComponent {
            type: "item"
            Container {
                layout: StackLayout {
                    layoutDirection: LayoutDirection.LeftToRight
                }
                ImageView {
                    imageSource: ListItemData.boxArt
                }
                Label {
                    text: ListItemData.title
                    textStyle {
                        base: SystemDefaults.TextStyles.TitleText
                        fontWeight: FontWeight.Normal
                    }
                }
            }
        }
    ]
}

Then I use a GroupDataModel class to provide the data:

GroupDataModel *model = new GroupDataModel(QStringList() << "title" << "boxArt");

QVariantMap map;
map["title"] = "Test Title";
map["boxArt"] = "http://www.foo.com/bar.jpg";
model->insert(map);

ListView *listView = findControl("titlesListView");
listView->setDataModel(model);

While running, I get this error in the logs:

Unused support scheme (http) in the url

This actually means that it is not possible to load an image from a URL or I go about it the wrong way?

OK, I was finally able to get this working.

Here is a code example to show how it was done:

App::App()
{
    //QNetworkAccessManager m_manager;
    connect(&m_manager, SIGNAL(finished(QNetworkReply*)),
         this, SLOT(replyFinished(QNetworkReply*)));
}

void App::setImage(const QString &url)
{
    m_manager.get(QNetworkRequest(QUrl(url)));
}

void App::replyFinished(QNetworkReply* reply)
{
    QByteArray data = reply->readAll();

    QImage qimage;
    qimage.loadFromData(data);

    int width = qimage.width();
    int height = qimage.height();
    PixelBufferData pixelBuffer = PixelBufferData(PixelBufferData::RGBX, width, height, width, qimage.bits());

    Image image = Image(pixelBuffer);
    m_imageView->setImage(image);
}

Tags: BlackBerry Developers

Similar Questions

  • Adding movieclip "loading" in the dynamic image gallery?

    Hello again,

    I finished my Gallery of images based on the XML, but the direct test after I realized I did a rookie mistake and not to put some kind of placeholder "loading" loop movie clip while the thumbnails - and the images at full size - are responsible. Images will appear randomly when loading and I would like to be able to insert a placeholder clip while they load and exchange with the thumbnails/images after that that it was loaded. The placeholder clip is in my library (loadingLoop), but I have problems to make it work properly.

    Here is the original function that transforms the XML and adds thumbnails; It's when I try to insert the clip of space reserved by XML child node (each attempt I did just keep throwing more errors, so I failed in my attempts to avoid confusion), and I joined the XML file for testing. And a preview or help would be appreciated.

    Browse to the external XML file and trigger the xmlLoaded when finished
    xmlLoader.load (new URLRequest("data/artGallery.xml"));
    xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);

    Load the XML file and process the location of images
    function xmlLoaded(event:Event):void {}
    XML = XML (event.target.data);
    analyze the nodes in the XML file
    xmlList = xml.children ();
    count the number of nodes in the XML via XMLList
    trace (xmlList.length ());
    loop to load all of the vignettes, based on the number of nodes in the XMLList
    "I am" = all of the child nodes in the XML file
    for (var i: int = 0; i < xmlList.length (); i ++) {}

    Add loadingLoop movie clip by node and wait for thumbnail to load before swapping with thumbnails imageLoader <-help!


    for each node, create a new instance to put on stage
    imageLoader = new Loader();
    load each thumbnail from its location by the 'thumb' of the XML node attribute
    imageLoader.load (new URLRequest (xmlList [i] .attribute ("thumb")));
    position of the miniature instances per XML node (horizontally on stage)
    imageLoader.x = i * 110 + 10; thumbs has so 100 x 100, + 10 for width, plus + 10 of left border
    imageLoader.y = 10;
    for each node in the XML list, the instance name with the path to the location of the image full size
    imageLoader.name = xmlList [i] .attribute ("source");
    for each node in the XML list, add a drop shadow
    imageLoader.filters = [thumbDShadow];
    Add thumbnails to stage
    addChild (imageLoader);
    dropTween = new Tween (imageLoader, "y", Bounce.easeOut,-100, 10, 1, true);
    implemented vignettes to wait click Run showPicture
    imageLoader.addEventListener (MouseEvent.CLICK, showPicture);
    set thumbnails to scale up when spilled
    imageLoader.addEventListener (MouseEvent.ROLL_OVER, sizeUP);
    }
    }

    my mistake.  use:

    function xmlLoaded(event:Event):void {}
    XML = XML (event.target.data);
    xmlList = xml.children ();
    for (var i: int = 0; i< xmllist.length();="" i++)="">

    var mc:MovieClip = new MovieClip();

    MC. Ivar = i;

    addChild (mc);

    MC. LDR = new Loader();
    MC. LDR. Load (new URLRequest (xmlList [i] .attribute ("thumb")));
    MC. LDR. Name = xmlList [i] .attribute ("source");

    MC.x = i * 110 + 10; thumbs has so 100 x 100, + 10 for width, plus + 10 of left border


    mc.addChild (mc.ldr);

    MC.loadingloop = new loadingLoop();

    mc.addChild (mc.loadingloop);
    MC.filters = [thumbDShadow];


    mc.ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, removeLoop);

    mc.addEventListener (MouseEvent.CLICK, showPicture);
    mc.addEventListener (MouseEvent.ROLL_OVER, sizeUP);
    }
    function removeLoop(event:Event):void {}
          event.target.loader.parent.removeChild (MovieClip (event.target.loader.parent) .loadingloop);
    }
    }

  • Navigate to url is producting a white flash before loading of the url

    Hello

    I'm wondering is someone can help me.  I placed a brief swf in a html page.  There is a single button entry that should load the next html page.  I used:

    var link: URLRequest = new URLRequest ("http://www.adobe.com");

    button_mc.addEventListener (MouseEvent.CLICK, onClick);

    function onClick(event:MouseEvent):void
    {

    navigateToURL (link)

    }

    button_mc.buttonMode = true;

    However there is a white flash screen before the opening of the url

    How can I avoid this.

    Thank you!

    Hello

    Maybe it's only because the new page HTML background is white, so that it displays the swf file is in fact starting to be on the page.

    But a link to what you are doing would be useful.

    ____________________

    Design Cyboide

    Creating websites Montreal

  • How to prevent from loading with the google images search results?

    Since I updated to FireFox 18 I get images (thumbnails of Web pages) with the results of my research with Google. I thought it was a problem of google but I don't have the problem in Internet Explorer.
    Please notify.

    OK horribi,

    go to the preferences of Firefox-> content and next to the selection "load images automatically" add an exception for the google site and block.

    Let us know the result!

  • Kitkat Android cause the loading of the SWF from device. Found but URL doesn't work

    Hello


    I am facing a problem for a long time about the access to the files in Kitkat Android version 4.4. *. I developed the Player Adobe Air for android app, and it does not work as expected following kitkat version but not on kitkat.

    I'm following this methods.

    1. NativeApplication.nativeApplication.addEventListener (InvokeEvent.INVOKE, onInvoke);

    public void onInvoke(event:InvokeEvent):void

    {

    var newFile:String = String(event.arguments[0]);

    trace ("new file received from Android:" + newFile)

    }

    Received in Android Kitkat - form URL device

    /Storage/emulated/0/.iProfData/SWF/playListFiles/ContentCreation/Ma_V2_522/en/animation/27 031_1_Welcome screen.swf

    file:///storage/emulated/0/.iProfData/SWF/playListFiles/ContentCreation/Ma_V2_522/en/Anim creation/27031_1_Welcome screen.swf

    -Loading of the URL by using the class loader in AS3 AIR but does not.

    file%3A///storage/emulated/0/.iProfData/SWF/playListFiles/ContentCreation/Ma_V2_522/en/ANI mation/27031_1_Welcome%20screen.swf

    -Have you used also by making the escape character, but still it is not working display of the file not found case both SWF and mp4. (Case of Mp4 NetStream.Play.FileNotFound)

    Using the above methods, I can have the url of the swf or mp4 video but when I load, it doesn't work error message that gives "file not found / IO Error. I read that if avoidance of the use of characters and then it will work but I used as escape character but it does work.

    Humble ask you to inform you please how I can solve this problem.

    Best regards

    Sunil Kumar

    From KitKat, Google requires that applications have access to the files on the system. You must specifically add READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE permissions in order to access the files. Adding or the other of these permissions should allow you to read / access to the files on the device. Before KitKat, you must have these permissions listed in the manifest to the files.

  • Firefox doesn't load the URLS of sites window, but will charge by search engine

    Firefox will not load any site that I type in the URL window. It loads any location of the tile to start or Google search results page. But never directly.

    The problem started a week ago.

    The problem persists in safe mode. I have a few extensions and plug-ins (No Add ons) but I have not installed new in the last year.

    I uninstalled it and installed a clean place. I did a refresh. Hardware accelerator is disabled. The only thing I have not tried is to create a new profile.

    I'm running Win 7 Ultimate 64 (although Mozilla is x 86).

    My security system is provided by Zone Alarm, but it has been the case for at least five years and never had a problem before.

    Any suggestions?

    Thank you

    The most likely cause is a bug in Firefox that has not yet been set.
    You need to rename a particular profile data file. Your browsing history will be lost, but the browser working again. It is hoped that there will be a better fix in Firefox itself soon.

    Current fix suggested. (Bug 1180419 partner)
    Rename the places.sqlite file as explained in this recently revised article.

    For more details, please see

    P. S.
    Please post to say how you're going.
    I know it's rather unlikely survey solution.
    I don't know if this particular problem standard reinstall, reinstall clean same standard don't fix it not she. The Firefox update also does not resolve it.

  • When I click on my icon of firefox homepage says "the address is not a valid URL. The URL is not valid and cannot be loaded. How can I fix it?

    When I downloaded Mozilla Firefox and clicked on the Firefox icon I get this message on the Firefox homepage "the address is not valid.

    The URL is not valid and cannot be loaded. "I can always access the internet but what do I do to get rid of this message. The home page does not display the icon of firefox.

    You can check the setting of the homepage:

    • Tools > Options > general > startup: Homepage

    Firefox supports several home pages separated by ' |' symbol (pipe).

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem.

    • Put yourself in the DEFAULT theme: Firefox/tools > Modules > appearance
    • Do NOT click on the reset button on the startup window Mode safe
  • Block specific images that I specify the URL

    I need to block some images that I specify the URL.

    I don't want this:
    -Block all images without discernment
    -Blocks Web sites as a whole.

    I want to see websites and its images, excluding certain SPECIFIC Image URL, I can specify.

    Please help with this problem.

    There is no built-in feature to this. You can check to see if there is an add-on that can do.

    https://addons.Mozilla.org/Firefox/

  • How can I fix the image of the error and get the regular image to load?

    Since the recent big update for Firefox I get a sort of error of loading of some images.
    Here: http://tinypic.com/r/103bf3l/8 I put one of these sites that give this error
    -The original which is supposed to show image is also available in this image
    Some sites give a different size of this image of the error, but it seems more like a triangle of error

    I've tried troubleshooting not loading images and none of these options worked
    If anyone has this problem or knows how to solve this problem, it would be a great help

    Solution found:
    With the theme "Stylish" addon "Google two themes" interfered with the loading of the image of the sites. Disable the theme was the solution.

  • How to disable the loading of the image, simply load html script or java e.t.c.

    I want to display HTML to a website in Firefox.
    It should not load image when the disable image is select and reload the page when the option is enabled.
    This option is available on java phones old Nokia I couldn't find in Firefox.

    Try maybe this add on the Image block

  • When I open another tab and type a Web site address, once the site loads the URL in the navigation bar disappears. Why?

    When I open a new tab and type the URL of the Web site, after that load the url of the Web site Web site disappears. In order for me to get him back, I have to right click on the navigation bar, then click Cancel. Why is this?

    Has this happened immediately after the reboot or at a later date?

    This only happens to you in a new tab?

    What is the current setting of the new tab as established through the browser.newtab.url pref page?

    You can open the topic: config page via the address bar.

    Rename or remove the file prefs.js and numbered possible prefs-# .js and the file user.js to reset all default prefs.

  • I get this error message 'The URL is not valid and cannot be loaded' when I try to go to Firefox home. I uninstalled the modules, uninstaleed and reinstalled a new fresh firefox which did not help

    I get the following error message 'The URL is not valid and cannot be loaded' when I try to go to firefox home. I uninstalled modules, uninstalled Firefox and then install a new version. Still have the problem.
    Thanks for the help

    This problem may be caused by a corrupt installation of Visual C++ or incomplete (several versions can be installed-by-side; SxS) it lacks certain runtime components (redistributable Packages), which depends on Firefox (problem with an embedded manifest file that specifies a specific runtime version).

    You need to install the missing components (for example, Redistrbutable end 2005 ++).

    • bug 713167 - Microsoft.VC80.CRT SideBySide errors, browsercomps.dll
  • During a flight over an image of a Web page, the URL associated with the image opens at the bottom of the browser. I don't want this information to appear whenever I have my cursor on a picture of the Web page. How to disable this option?

    The pop-up window appears in the bottom left of the browser Firefox. Yet once, it displays the URL by clicking on the image for each image on the Web page.

    The easiest way is to use the add-on of status-4-Evar. With it, you can choose to not display the messages State or hover URL preview, or rather display them in the bar modules or the address bar.

    https://addons.Mozilla.org/firefox/addon/status-4-EVAR

  • Windows Update page does not load, another updater with "update" in the url does not work, and the microsoft Download Center will not download. Help!

    Right. I read the other posts and do not know if it's the same or not, but...

    Update Windows page fails to load - no error message
    antivirus and another updater with update in the URL cannot purely and simply, or don't load - no error message
    any attempt to download anything from microsoft download site fails to load - no error message

    I got stardock, not my colors, uninstalled

    same result.

    any ideas?

    CLM-NSWG4,
    It seems to me that you can have to deal with a virus\malware infection.  You can watch these threads discuss virus problems and see if you are able to detect problems, that I suggest you use an online scanner (if you are able to) and scan your system.

    Windows Live OneCare Safety Scanner Windows 7\Vista

    Windows Live OneCare Safety Scanner Windows XP

    Get rid of malware

    Can I clean an already infected computer?

    If you need more help then read: what to post in the Windows Update forum
    Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How can I find the URL codes for images stored in the Windows Photo Gallery?

    How can I find the URL codes for images stored in the Windows Photo Gallery?

    If you want the path to the current record
    right click to the picture location of a photo...
    and choose... Properties / General tab.
    Location displays the path.

    If you have a photo saved on your hard drive
    car that was downloaded on the net...
    the original URL will appear not in
    the file.

Maybe you are looking for