first application

I'm working on my first app, and I'm doing a button that pulls a .jpg from the internet and displays file in my application, then if I hit the new button shoots an another .jpg to replace the one currently being displayed.

I don't want to launch the browser, I want to just download and display the image

If you want to download an image, you can use this:

(I do not write this code, I found it in this forum but works!)

public Bitmap Download Image(){
 InputStream inputStream = null;
 HttpConnection connection = null;
 EncodedImage bitmap;
 Bitmap _bmap;
 byte[] dataArray = null;
 String url = "";

try {

 url="www.myserver/myimage.jpg"
connection = (HttpConnection) Connector.open(url,Connector.READ_WRITE, true);
inputStream = connection.openInputStream();
byte[] responseData = new byte[10000];
int length = 0;
StringBuffer rawResponse = new StringBuffer();
while (-1 != (length = inputStream.read(responseData))) {
    rawResponse.append(new String(responseData, 0, length));
                }
int responseCode = connection.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
                    throw new Exception("HTTP response code: " + responseCode);
                }

final String result = rawResponse.toString();
dataArray = result.getBytes();
    }
    catch (final Exception ex) {
            }
    finally {

        try {
        inputStream.close();
        inputStream = null;
        connection.close();

                } catch (Exception e) {
                }
            }

bitmap = EncodedImage.createEncodedImage(dataArray, 0,  dataArray.length);
Bitmap imageDownloaded=bitmap.getBitmap();
return imageDownloaded;

    }

That, you get the bitmap, then you can put him in the place you need.

PS: Sorry for my English.

Tags: BlackBerry Developers

Similar Questions

  • I'm not able to install both on the same PC LabVIEW applications. I have uninstall the first application in order to install the second. Is there a way to avoid this?

    I wrote two LabVIEW applications. The first acquires data from three different devices, displays the data and writes it to a file. The second application reads the data and displays it on the screen.

    Can I install the first application and run it, but I can only install the second application if I uninstall the first application.

    Any ideas as to why this is happening?

    You install applications by using a Setup program created with the application builder to LV?

    What LV version do you use?

    You have a dedicated for each installer build script, or do you still want to change the settings of a single build script (which would be a reason for this behavior!)?

    hope this helps,

    Norbert

  • First application opens, but never the workspace is displayed. I screw up a framework?

    First application opens, appears to load - I get app bar on top, but when I try to open an existing or new project... nothing. Tried to change the Workspace window, opening to a different file type, a simple .mov file import, but the workspace never shows up. MacBook Pro (mid 2012, i7 clocked at 2.6 GHz, 16 GB, 500 GB of SSD, Nvidia 650 M, El Capitan 10.11.1)

    Hi JohnnyL,

    + 1 for the comment John. However, if this does not work, rename this folder: Documents > Adobe > "Premiere Pro" to ' "Old_Premiere Pro". "

    Note: You will lose your customizations and keyboard shortcuts.

    Thank you

    Regalo

  • Our first application

    I am pleased to announce that our first application developed with Adobe DPS already released in the appstore. It is the first of a collection of different travel guides with unusual ideas. It's in Spanish, but maybe in some time in English too.

    I hope you like it!

    http://iTunes.Apple.com/us/app/Guia-Londres-skpa/id550354761?l=es & ls = 1 & MT = 8

    Congratulations!

    Bob

  • Click of the mouse stops working after you start the first application

    Hard to explain this problem.  First time I click on what either in an application after computer startup (Word, Excel, etc.) the arrow of the mouse moves, but the click does not, anywhere, not on the desktop, taskbar anywhere.  Accentuates not delayed anything either.  But when I press ctrl-alt-delete, move the arrow down to start the Task Manager and click here, then click Start to work and things get even once highlighted and everything seems normal.  HP Pavilion dv9000t Vista Home Premium 32-bit Intel Core 2 duo, 2 GHz, 2GBDDR, this is going on for about 6 months now.  I just noticed, I installed a trackball logitek, and after installation, it does the same thing.

    Hello

    ·         What is the brand and model of the computer or the mouse?

    ·         Did you do changes on the computer before the show?

    Follow the suggestions below for a possible solution:

    Method 1: I suggest you to run the Microsoft fixit from link and check mentioned below.

     

    Hardware devices do not work or are not detected in Windows

    http://support.Microsoft.com/mats/hardware_device_problems/en-us

     

    Method 2: I suggest you to check and clean the boot if the problem persists.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

     

    Note: After troubleshooting, be sure to configure the computer to start as usual as mentioned in step 7 in the above article.

    Let us know the results.

  • Problems to make my first application work

    Hello, I am new in the development of blackberry applications, but not new in development (C++, C, c#, JAVA).

    I am facing some problems with my first development for the blackberry in JAVA platform.

    MyScreen code:

    public final class MyScreen extends MainScreen
    {
    
        EncodedImage mImage = EncodedImage
                .getEncodedImageResource("icon.png");
        ApplicationIcon mIcons = new ApplicationIcon(mImage);
    
        ApplicationIcon mIcon = mIcons;
    
        private static Date cDate;
        private String lefteds = "";
        private  LabelField leftd = new LabelField("Not set");
        private TextBoxField tbf = new TextBoxField(200, 30);
       // private GridFieldManager grid = new GridFieldManager(3,3,1);
        //private VerticalFieldManager _manager;
        private LabelField Leftd2 = new LabelField("Not set");
        private int Inum = -1;
    
        //-----------------------------------------------
        private static PersistentObject store = PersistentStore.getPersistentObject(0x1dfc10ec6454eb14L); 
    
        public void saveUserInfo(){
            synchronized(store) {
                store.setContents(leftd);
                store.commit();
            }
        }
    
        public LabelField getlefted() {
            LabelField leftd;
            synchronized(store) {
                leftd = (LabelField)store.getContents();
                if(leftd == null) {
                    leftd = new LabelField("Not Set!");
                }
            }
            return leftd;
        }
        //-----------------------------------------------
    
        MenuItem menuRegister = new MenuItem("Add status icon", 0, 0) {
            public void run() {
                registerIndicator();
            };
        };
    
        MenuItem menuUnregister = new MenuItem("Remove status icon", 0, 0) {
            public void run() {
                unregisterIndicator();
            };
        };
    
        protected void makeMenu(Menu menu, int instance) {
            super.makeMenu(menu, instance);
            menu.add(menuRegister);
            menu.add(menuUnregister);
        }
    
        private void registerIndicator() {
            try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
                        .getInstance();
                ApplicationIndicator indicator =
                        reg.register(mIcon, false, true);
                indicator.setVisible(true);
            } catch (Exception e) {
            }
        }
    
        private void unregisterIndicator() {
            try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
                        .getInstance();
                reg.unregister();
            } catch (Exception e) {
            }
        }
    
        void updateValue(int value) {
            try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
                        .getInstance();
                ApplicationIndicator appIndicator =
                        reg.getApplicationIndicator();
                appIndicator.setValue(value);
            } catch (Exception e) {
            }
        }
    
        void updateIcon(ApplicationIcon icon) {
            try {
                ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry
                        .getInstance();
                ApplicationIndicator appIndicator =
                        reg.getApplicationIndicator();
                appIndicator.setIcon(icon);
            } catch (Exception e) {
            }
        }
    
        //--------------------------------------------------
    
        public MyScreen()
        {
            try
            {
            this.Leftd2.setText(getlefted().getText());
            }
            catch (Exception e)
            {
    
            }
    
             Background bg = BackgroundFactory.createSolidBackground(Color.LIGHTGRAY);
             setBackground(bg);
    
               XYEdges edges = new XYEdges(20, 20, 20, 20);
               Border border = BorderFactory.createBevelBorder(edges);
    
            // Set the displayed title of the screen
             setTitle("CountDown");
             ButtonField b = new ButtonField("Set CountDown", ButtonField.CONSUME_CLICK);
    
             b.setChangeListener(customListener);
             add(b);
    
             this.tbf.setText("Days to go!");
             add(Leftd2);
    
             add(this.tbf);
    
             if (this.Leftd2 == null)
             {
             saveUserInfo();
             }
    
        }
    
        public void calculate()
        {
            Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
            c.setTime(new Date(System.currentTimeMillis())); //now
    
            Date currentdate = c.getTime();
    
            int lefted = (int)((cDate.getTime() - currentdate.getTime()) / (1000 * 60 * 60 * 24)) + 1;
            lefteds = lefted + "";
            leftd.setText(lefted + " " + this.tbf.getText());
            Leftd2.setText(lefted + " " + this.tbf.getText());
            saveUserInfo();
            this.Inum = lefted;
            updateValue(lefted);
    
        }
    
          FieldChangeListener customListener = new FieldChangeListener() {   
    
                public void fieldChanged(Field field, int context) {    
    
                     DateTimePicker datePicker = DateTimePicker.createInstance();
                     datePicker.doModal();
                     Calendar cal = datePicker.getDateTime();
                     Date date = cal.getTime();
                     MyScreen.cDate = date;
                     calculate();
                }
                 };
    
        }
    

    It's part * beep * ugly code and also, my application

    There are some problems with it (apart from the fact that its badly coded, etc.).

    Why is my device reboots as a minute after I launch my app (while the app completely closed)?

    Is why I set the status bar would not appear as it should?

    I hope that someone here would be able to help me, I'm sort of stuck... I must be trying to include to the top of my own for almoste time.

    Thank you very much.

    "I have being trying to understand by myself for almost an hour."

    What - only an hour?

    There is a little run before you can walk through this code, suggest a slightly lower rate.

    Two things that I would look at first.

    (1) but first reboot the device.  I'm guessing that you have an older device and you compile using a more recent environment.  Do not forget the applications being forward but not backward compatible, you should develop with a JDE older than the operating system on your device.

    Allied to this I'll make sure your app is not started automatically.

    (2) you seem to try to persist a LabelField:

    public void saveUserInfo() {}
    {Synchronized (Store)}
    store.setContents (leftd);
    Store.Commit ();
    }
    }
       
    public getlefted() {} LabelField
    LabelField leftd;
    {Synchronized (Store)}
    leftd = (LabelField) store.getContents ();
    if(leftd == null) {}
    leftd = new LabelField ("Not Set!");
    }
    }
    Return leftd;
    }

    To be persistent, an object must implement Persistable.  LabelField doesn't do this.  If you want to save a LabelField, what you save is the text (a string that is persistent) and recreate it.

    See how you go after looking through this.  But I recommend to start simple (just count) before adding things as indicators and persistentStore.

  • Detect the first application running

    I create an application with a SQLlite database in the SD card. The application is already installed in the device and the database has already been created on the SD card.

    However, I have a newer version of the application and a newer database structure for it. I want to change the database table when the user launches the application newer version for the first time.

    The problem is: how to detect that the application is running for the first time?

    You have many options to do so, but according to my suggestion, you can have an object stored in the persistent store to indicate the version of the app and start can check if the application has the same version number as the stored object.

  • What is the best/best way to get just Photoshop and first applications?

    Hello Adobe community.

    I'm curious the best about the ideal way to get just Photoshop and first. I have currently the library full of Adobe applications, and I noticed that I don't use the majority of the applications outside of these two. My subscription of the year ends in November (thank you for Black Friday deals). I want an idea of some of the things that I can do to save money and get the best value for both applications as the price of subscriptions is a little strange.

    After watching the price of subscriptions and their descriptions, is logical that the best option I have is to get the Plan of Single-App creative cloud for first ($19.99 per month) and also opt it for the Photoshop & Lightroom Plan ($ 9.99 per month)?

    The price, I was looking at: plans membership: pricing and subscriptions | Adobe Creative Cloud

    I appreciate any help I can get. See you soon!

    If you want these two programs (Lightroom does bundle special photographer, but there is of course no need to install or use) then what you described is the only way

    Don't forget to cancel your existing subscription before the end of your current period

    Cancel see answer #1 in https://forums.adobe.com/thread/2023066 - includes a link to Chat from Monday to Friday

    -or directly at this link https://helpx.adobe.com/creative-cloud/help/cancel-membership.html

  • My first application

    Hello

    I want to start developing applications playbook. Please let me know which is the proper place for me.

    The applications I want to develop is comparable to create a backup and restore the data.

    Take a look at this thread http://supportforums.blackberry.com/t5/Native-Development/help-with-helloworld-display/td-p/1503381/... about the error you are getting.

  • Building my first application

    Guys, I'm new to the forum. I built a base application that opens a menu IM--> system Messages.

    However after that giving a sleep of 1000 ms the application switches to the MyScreen.java.However I don't want my MyScreen is visible. I want my Menu IM to stay on the bb screen, and then I want to access the menu--> options--> and the following screen... Help me pzzz. And don't forget that I am new to the community. Thank you

    package mypackage;
    
    import net.rim.device.api.system.ApplicationManager;
    import net.rim.device.api.system.ApplicationManagerException;
    import net.rim.device.api.system.SystemListener;
    import net.rim.device.api.ui.UiApplication;
    
    /**
     * This class extends the UiApplication class, providing a
     * graphical user interface.
     */
    public class MyApp extends UiApplication implements SystemListener
    {
        /**
         * Entry point for application
         * @param args Command line arguments (not used)
         */
        public static void main(String[] args)
        {
            //BlackBerryMessenger bbm= BlackBerryMessenger.getInstance();
    
       try {
                ApplicationManager.getApplicationManager().launchApplication("net_rim_bb_qm_peer");
             }
         catch (ApplicationManagerException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
    
         try {
                Thread.sleep(1000);
             }
          catch (InterruptedException e)
            {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    
            // Create a new instance of the application and make the currently
            // running thread the application's event dispatch thread.
            MyApp theApp = new MyApp();
            theApp.enterEventDispatcher();
    
         try
         {
                Thread.sleep(1000);
         }
    
         catch (InterruptedException e)
    
         {
                // TODO Auto-generated catch block
                e.printStackTrace();
         }
    
       }
    
        public MyApp()
        {
            // Push a screen onto the UI stack for rendering.
            pushScreen(new MyScreen());
        }
    
        public void batteryGood() {
            // TODO Auto-generated method stub
    
        }
    
        public void batteryLow() {
            // TODO Auto-generated method stub
    
        }
    
        public void batteryStatusChange(int status) {
            // TODO Auto-generated method stub
    
        }
    
        public void powerOff() {
            // TODO Auto-generated method stub
    
        }
    
        public void powerUp() {
            // TODO Auto-generated method stub
    
        }
    }
    

    I used your code then change MyScreen.java

    Import net.rim.device.api.system.Application;
    Import net.rim.device.api.system.ApplicationManager;
    Import net.rim.device.api.system.ApplicationManagerException;
    Import net.rim.device.api.ui.MenuItem;
    Import net.rim.device.api.ui.container.MainScreen;

    /**
    * A class that extends the class screen, which offers default standard
    * behavior for BlackBerry GUI applications.
    */
    / public final class MyScreen extends form {}
    /**
    * Creates a new object of MyScreen
    */
    public MyScreen() {}
    Set the displayed title of the screen
    setTitle ("MyTitle");
    addApplicationMenu (this);

    }

    /**
    * Adds a menu that allows the user to perform various message store
    * actions.
    *
    @param screen
    Screen to add the menu to
    */
    void addApplicationMenu (screen display) {}
    AppendUnreadMenuItem MenuItem = new MenuItem ("open Messenger", 1, 1) {}
    public void run() {}
    try {}
    ApplicationManager.getApplicationManager)
    .launchApplication ("net_rim_bb_qm_peer");
    } catch (ApplicationManagerException e) {}
    e.printStackTrace ();
    } {Finally
    Application.getApplication () .requestBackground ();
    }

    }
    };

    mainScreen.addMenuItem (appendUnreadMenuItem);

    }
    }

    and remove the code from MyApp.java. your MyApp will be like this

    **
    * This class extend the UiApplication class, providing a
    * graphical user interface.
    */
    SerializableAttribute public class MyApp extends UiApplication
    {
    /**
    * Entry point for application
    @param args command-line arguments (not used)
    */
    Public Shared Sub main (String [] args)
    {
    Create a new instance of the application and make the currently
    who runs the thread of the application of the event dispatch thread.
    MyApp PAP = new MyApp();
    theApp.enterEventDispatcher ();
    }

    /**
    * Creates a new object MyApp
    */
    public MyApp()
    {
    Push a screen onto the stack in the user interface for rendering.
    pushScreen (new MyScreen());
    }
    }

    (or just copy the code to PASE in your eclipse).

  • Develop my first application Berry... Help, please

    Hey guys, my client wants an app for his business, this will be my first development for BB, and I know there is resolutios of different screen for different devices of BB. What templates should I build the app for? I mean, what resolution should I use for the graphics? should I go for the most popular models (the market is in the United States) or the various interfaces buid?

    Thank you

    DC

    Welcome to the forums and good luck with the update.

    Now to your questions:

    "What templates should I build the app for? I mean, what resolution should I use for the graphics? should I go for the most popular models (the market is in the United States) or the various interfaces buid? »

    Try not to target a specific model, unless this model has a specific feature that you need (i.e. The accelerometer of the Storm and Storm2).

    The most common resolutions are 480 x 360 and 320 x 240. These two resolutions stop you from coding for the rest. In fact all first in these resolutions and chop a little, you should get it to work in odd resolutions.

    A common way to manage resolutions is to build the highest resolution and reduce images or use images as little as possible.

    If you have any other questions, post it here.

  • more features on my first application

    IM OK a new at this whole business of programming, this is my first http://appworld.blackberry.com/webstore/content/133047 app, I would like to add a few features to it.

    Im trying to add on the part of twitter, facebook and common features such as email to her. When the page goes to the web from my app then I still implement part features. I saw a video of the other day with pic and shared on the side option.

    Hi quincar,

    Check that http://supportforums.blackberry.com/t5/Cascades-Development/Share-some-text-on-Twitter-Facebook/m-p/...

    Also

    https://www.BlackBerry.com/jira/browse/BBTEN-115

  • First application of Clip for Smartphones-Audio track

    I see how to add a piece of music with video, but I want to add a vocal track.  I would like to make a report like you see on TV with a journalist's voice track (Voice over), so I can see my video but hear my narration.  You can record a voice track?

    Hi Lee,.

    Thank you have downloaded the app and your feature request record a narration follow in the application.

    You can record a voice on a desktop product like Adobe Audition or Audacity and save it in your iTunes (iOS) or your music files (Android). Once it is synced with your mobile device, you can bring this soundtrack in as you would a music soundtrack.

    Thanks again for your feature request, we are always looking for ways to improve the application!

    Bronwyn

    Product Manager

  • First application created

    Hello. I created my first app apex via a CSV file import. I use this single table just to see how the data is displayed in the default APEX. The table has about 1500 lines, but I can't just to show 500 records. The drop pages, * "until 1-10 out of more than 500" *, does not display that * "until 491-500 of 500" *.

    (1) how to see the rest of my data?

    (2) how can I change the number of lines displayed per page?

    Thanks in advance.

    You can change that in the ' * change the status of--> paging (Section) * ", you must change the field 'no lines per page' and 'maximum no of lines read.
    You will find a detailed explanation in the documentation here.

  • [JS] [CS4] Search pages to find the first application of a master spread?

    I'm working on a script that search masters spreads for specific text. Once it is found, the master spread name is returned. Now I'm stuck looking for pages to find where this master spread is applied first. Any help?

    var doc = app.activeDocument;
    
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
    app.findChangeTextOptions.includeMasterPages = true;
    app.findTextPreferences.findWhat = "custom text";
    
    var finds = doc.findText();
    if (finds.length > 0) {
        
              var mspage = finds[0].parentTextFrames[0].parent.name;
              var dpage = doc.pages[0].appliedMaster.name; //This of course is not right, it's returning the name of the master spread for whatever page is currently selected. So how do I set the current page to the page that first uses the found master spread (mspage)?
    

    You will have to look for him.

    var i, dpage;
    for (i=0; i<=doc.pages.length; i++) {
      if (doc.pages[i].appliedMaster == mspage) {
        dpage=doc.pages[i];
        break;
      }
    }
    

    However, if ever he finds one, you will get an error.

Maybe you are looking for

  • Outlook Express 6.

    Recently the links don't work; WHEN I PRESS a link in an e-mail message, the new address appears at the foot of the screen but then stops. Help please I like Outlook Express and want to continue using it. PC uses Windows XP

  • Pavilion dv7: help startup password

    As soon as I start my laptop, I asks me to enter unlock password after three tries, I got an entry unlock password(key:59280834)

  • Where can I find the pairing on printer HP PSC 1610xi UBS code?

    Where can I find the pairing on printer HP PSC 1610xi UBS code? This is sometimes called the PIN code Thank you LARR

  • W10 Upgrade won't let not the W7 updates run

    Removed KB3035583 and 2952664 and them hidden, and then click Restart. Can still see '14 updates for W7 are ready to download' but when select 'OK', it does nothing except "W10 upgrade is ready." Cannot see that updates of w7 by pressing 'check updat

  • VPN 3000 - no access console

    I have a 3000 VPN that needs to be reconfigured, but I get no output from the console port. Is there a way to set default values without access to consoles? Thank you