IndexOutOfBoundsException

Hi all

I am working on an app playbook.

My application requires images in icons and wallpaper application.

Now I HAV 17 images in my images/src folder and works well on the Simulator and Flash Builder.

But when add a new image to the folder src/images, I can't run the Simulator application. I get the following error:

With the help of icon: D:\xampp\htdocs\MyNomadesk-debug\images\blackberry-tablet-icon.png
The manifest file is valid.
Package created: C:\Users\aswathy\Adobe Flash Builder 4\MyNomadesk/MyNomadesk.bar
java.lang.IndexOutOfBoundsException
at java.io.ByteArrayOutputStream.write (unknown Source)
at com.qnx.bbt.deploy.Deploy.readPackage(Deploy.java:173)
at com.qnx.bbt.deploy.Deploy.verifyPackageId(Deploy.java:138)
at com.qnx.bbt.deploy.Deploy.sendRequest(Deploy.java:124)
at com.qnx.bbt.deploy.Deploy.run(Deploy.java:100)
at com.qnx.bbt.deploy.Deploy.main(Deploy.java:73)
Error: null
Deployment failed: 1

When I go through the forum I found some people got the same problem and solved when the removed the unwanted images. But all my 17 images are necessary for my application.

And this works fine in Flash Builder, when I run as a desktop (without exception) application.

Does anyone have a solution for this problem?

Thank you

Vuille

My game has more than 30 images and it works fine without any problems. How to use your images? You embed them?

Also, the other thread indicates that this issue has been resolved with the sdk 0.9.1. What version do you use?

Tags: BlackBerry Developers

Similar Questions

  • IndexOutOfBoundsException is thrown when you try to access the HorizontalFieldManager field

    How can I add several HorizontalFieldManagerss at the same screen -

    The line - getField (3); in below code throws an indexoutofboundsexception. I'm not sure why?

    LabelField l1 = new LabelField ("test");
    LabelField l2 = new LabelField ("test");
    LabelField l3 = new LabelField ("test");
    LabelField l4 = new LabelField ("test");
                
    HorizontalFieldManager h1 = new HorizontalFieldManager()
    {
    ' public void sublayout (int width, int height)
    {
    Super.sublayout (width, height);
    super.setExtent (height, height);
    }
    };
    H1. Add (L1);
    H1. Controls.Add (L2);
    Add (H1);
            
    HorizontalFieldManager h2 = new HorizontalFieldManager()
    {
    ' public void sublayout (int width, int height)
    {
    Super.sublayout (width, height);
    super.setExtent (height, height);
    getField (3);
    }
    };
    H2. Add (L3);
    H2. Add (L4);

    Add (H2);

    that works, thank you for your help

  • IndexOutOfBoundsException and invokeAction

    Hello

    I have an IndexOutOfBoundsException trying to rollback and editable table. In my case, I don't want to see "no data found", so I have to createInsert one line if no data is found. I use an involeAction with a refreshCondition for this.

    The use case is easy to reproduce:

    In the HR schema, create an editable on the job table. Drag n drop the restore as commandButton control action. In pageDef, add a 'createInsert' with if necessary refresh invokeAction:
    <invokeAction id="createInsert" Binds="CreateInsert" Refresh="ifNeeded"
                      RefreshCondition="#{bindings.JobsView1Iterator.currentRow==null}"/>
    When you change a line if the user clicks the Cancel button, the exception is thrown:
    java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
         at java.util.ArrayList.RangeCheck(ArrayList.java:547)
         at java.util.ArrayList.get(ArrayList.java:322)
         at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:3055)
         at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2906)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareRender(PageLifecycleImpl.java:561)
         at oracle.adf.controller.faces.lifecycle.FacesPageLifecycle.prepareRender(FacesPageLifecycle.java:81)
         at oracle.adf.controller.v2.lifecycle.Lifecycle$9.execute(Lifecycle.java:236)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:197)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.access$1000(ADFPhaseListener.java:23)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$5.before(ADFPhaseListener.java:402)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener.beforePhase(ADFPhaseListener.java:64)
         at oracle.adfinternal.controller.faces.lifecycle.ADFLifecyclePhaseListener.beforePhase(ADFLifecyclePhaseListener.java:44)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:327)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:236)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:509)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    What could be?

    Without the invokeAction, it works well. I use jdevelopper 11.1.2.3.0.

    Hello

    Hi you can try and dismiss the refresh condition to check that it comes from the EL update? If so, then first of all I would suggest using $ instead of # the EL expression shape # being resolved during the rendering of the user interface that is too late for the affection you need. Second, if the help $ does not resolve the problem, try RefreshCondition = "${bindings." JobsView1Iterator.estimatdRowCount == 0}"/ >

    Frank

  • Custom B-Tree comparer causes IndexOutOfBoundsException

    My apologies, I can't understand how to format the code below.

    I created a database that uses a custom comparer of B-Tree for a key whose type is long. The comparator reverse just the sort order for long so that entries with a larger values long for their keys are returned earlier during the iteration.

    For some reason, method compares to my custom comparer survey an IndexOutOfBoundsException when trying to insert values.

    Configuration of the database:



    EnvironmentConfig envCfg = new EnvironmentConfig();
    envCfg.setAllowCreate (true);
    envCfg.setTransactional (true);
    This.env = new environment (dbDir, envCfg);

    DatabaseConfig dbCfg = new DatabaseConfig();
    dbCfg.setAllowCreate (true);
    dbCfg.setTransactional (true);
    dbCfg.setSortedDuplicates (false);
    dbCfg.setBTreeComparator (ReverseLongComparator.class);

    Database classDb = this.env.openDatabase (null, "ClassDb", dbCfg);
    this.classCtlg = new StoredClassCatalog (classDb);

    this.deploymentDb = this.env.openDatabase (null, "MaBase", dbCfg);
    this.keyBinding = TupleBinding.getPrimitiveBinding (Long.class);
    this.depRecBinding = new SerialBinding < MyRecord > (this.classCtlg, MyRecord.class);

    map = new StoredSortedMap < Long, MyRecord.class);




    ReverseLongComparator:



    public class ReverseLongComparator implements comparator < byte [] >, Serializable {}

    private static final long serialVersionUID = 1 L;

    @Override
    public int compare (byte [] o1, o2 byte []) {}
    long k = o1.length == 1? 0: LongBinding.entryToLong (DatabaseEntry (o1) new);
    long k2 = o2.length == 1? 0: LongBinding.entryToLong (new DatabaseEntry (o2));

    We want the keys to be sorted most recent first. Switch the order
    the comparison
    Return Long.compare (2 k, 1 k);
    }
    }




    Code to store a record:



    public void storeRecord (final MyRecord rec) bird Exception {}
    Worker TransactionWorker = new TransactionWorker() {}
    @Override
    Public Sub doWork() throws Exception {}
    Map.put (Rec.GetId (), Rec.);
    }
    };

    runTxnWorker (this.txnRunner, worker);
    }




    The error occurs inside ReverseLongComparator. During the first record insertion, the second byte [] o2 has length zero. When the LongBinding.entryToObject is called, the exception is thrown.

    Published by: 947907 on July 21, 2012 10:45

    Thank you. The stack trace shows your comparator called when writing to the database of class catalog. I'd know the error in your code as soon as possible:

    DatabaseConfig dbCfg = new DatabaseConfig();
    dbCfg.setAllowCreate(true);
    dbCfg.setTransactional(true);
    dbCfg.setSortedDuplicates(false);
    dbCfg.setBTreeComparator(ReverseLongComparator.class);
    Database classDb = this.env.openDatabase(null, "ClassDb", dbCfg);
    this.classCtlg = new StoredClassCatalog(classDb);
    this.deploymentDb = this.env.openDatabase(null, "MyDatabase", dbCfg);
    

    You use the same configuration of db for class catalog db with respect to your db app. Your comparison tool will not work with the catalog db class.

    -mark

  • Publish on weblogic with IndexOutOfBoundsException aborts

    Hello

    I'm having some trouble of project deployment of Configuration for OSB on my weblogic application server. Here is my scenario:

    I have two separate projects of the Configuration for OSB (let's call them A and B). I currently have A project deployed on weblogic. When I try to cancel the deployment (remove) A project I get the below error. I get the same error when I try to deploy the project B.

    I tried cleaning, restart and same removal and addition of the server in eclipse, but re-ancestral guard error.

    Error
    Runtime exception occurred during the postback. The publication is abandoned. Please report the bug with the stack trace. The battery can be found on the newspaper and the display of the error log.


    Stack trace
    java.lang.IndexOutOfBoundsException: Index: 0, size: 0
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at com.bea.alsb.server.publish.ALSBPublishOperation.checkModuleStatus (unknown Source)
    at com.bea.alsb.server.publish.ALSBPublishOperation.execute (unknown Source)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.performTasks(WeblogicServerBehaviour.java:1253)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:804)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:660)
    at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:526)
    at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:708)
    at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:2731)
    to org.eclipse.wst.server.core.internal.Server$ PublishJob.run (Server.java:278)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

    Session data
    eclipse.buildId = unknown
    Java.version = 1.6.0_17
    Java.Vendor = Oracle Corporation
    BootLoader constants: OS = win32, ARCH = x 86, WS = win32, NL = en_US
    Command line arguments:-OS win32 - ws win32-arch x 86

    More details

    Eclipse
    Version: 3.5.2
    Build id: M20100211-1343

    WebLogic
    Group of patches Oracle WebLogic Server 11 GR 1 material 2

    Any help is very appreciated.


    Thank you
    Adel.

    You must remove the sbconsole not from the ide projects.
    the ide will sync with the console.

    Close the ide
    Navigate to http://localhost: port/sbconsole > projects and remove all the stuff.
    You again open the ide, clean (just to make sure) the project again and try again

  • Exception IndexOutOfBoundsException when trying to deploy

    Hi all

    I am facing a problem when I try to run or debug my app. I made this app in air 1 year ago and recompile with the blackberry sdk (I also integrate some swc libraries that I can't recompile).

    When I try to debug or run that I have an exception message:

    It's questions - bug in Packager - caused by lots of files bundled in your application.

    The work around:

    Do not use the option - airpackager launchApp (or launch of the FB integration options),

    use blackberry - deploy tool (command line), but instead specify package- option, you must explicitly specify - package-name and - package-options id. the package name you need to know (comes from app.xml) but the package id is the unique name generated automatically - you can extract file .bar if you unpack and check the META-INF/MANIFEST. MF for the Id attribute of the Package (also package id is printed on the console when you install the application on the Simulator).

  • Calendar events indexoutofboundsexception

    Hi, I get the error on this line:

    Hello, I found the solution to the problem. I firstly all the fields available for the event, then check if the field is something present in this array of integers. If this is the case, you can go ahead with the code otherwise, continue with the enumeration. If you need code, let me know!

    I hope this helps for developers!

  • Manager custom, throw IndexOutOfBoundsException when call deleteAll()

    import java.util.Vector;

    Import net.rim.device.api.system.Bitmap;
    Import net.rim.device.api.system.Characters;
    Import net.rim.device.api.ui.Color;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.Graphics;
    Import net.rim.device.api.ui.Manager;
    Import net.rim.device.api.ui.Ui;
    Import net.rim.device.api.ui.UiApplication;

    SerializableAttribute public class LrcManager extends Manager {}
    private int _width, _height;
    _background private bitmap;
    private int currentIndex;
        
    protected LrcManager (int width, int height, Bitmap background, long style) {}
    Super (style);
    _width = width;
    _height = height;
    _background = background noise;
    }

    private int startIndex, endIndex;
        
    protected void sublayout (int maxWidth, maxHeight int) {}
    If (this.size () > 0) {}
    int currentItemY = _height/2 + this.getField (currentIndex) .getPreferredHeight () / 2;
                
    for (int i = currentIndex; I > - 1; i--) {}
    ((LrcItem) getField (i)) .setColor (Color.LIGHTGRAY);
                    
    currentItemY = this.getField (i) .getPreferredHeight ();
    this.setPositionChild (this.getField (i), (_width - this.getField (i) .getPreferredWidth ()) / 2, currentItemY);
    layoutChild (this.getField (i), _width, _height);
    If (currentItemY<>
    startIndex = i;
    break;
    }
    }
        
    currentItemY = _height/2 + this.getField (currentIndex) .getPreferredHeight () / 2;
                
    for (int i = currentIndex + 1; I
    ((LrcItem) getField (i)) .setColor (Color.LIGHTGRAY);
                    
    this.setPositionChild (this.getField (i), (_width - this.getField (i) .getPreferredWidth ()) / 2, currentItemY);
    currentItemY += this.getField (i) .getPreferredHeight ();
    layoutChild (this.getField (i), _width, _height);
    If (currentItemY > _height) {}
    endIndex = i;
    break;
    }
    }
                
    ((LrcItem) getField (currentIndex)) .setColor (Color.WHITE);
    }
    setExtent (_width, _height);
    }
        
    protected void subpaint (Graphics g) {}
    If (this.size () > 0) {}
    for (int i = startIndex; I
    this.paintChild (g, this.getField (i));
    }
    }
    }
        
    protected void paintBackground (Graphics graphics) {}
    If (_background! = null)
    graphics.drawBitmap (0, 0, _width, _height, _background, 0, 0);
    }

    public void ForwardToPos(int second) {}
    If (((LrcItem) getField (currentIndex + 1)) .second)<>
    currentIndex ++;
    UiApplication.getUiApplication () .invokeAndWait (new Runnable() {}
    public void run() {}
    layout (_width, _height);
    updateLayout();
    Invalidate();
    }
    });
    }
    }
        
    public void setPos(int second) {}
    for (int i = 0; i)
    If (((LrcItem) (i) getField) .second > = second) {}
    currentIndex = i;
    UiApplication.getUiApplication () .invokeAndWait (new Runnable() {}
    public void run() {}
    layout (_width, _height);
    updateLayout();
    Invalidate();
    }
    });
    return;
    }
    }
    currentIndex = size () - 1;
    }

    public void add (field) {}
    throw new UnsupportedOperationException();
    }
    {} public void addAll (fields [])
    throw new UnsupportedOperationException();
    }
    public final void insert (field) {}
    throw new UnsupportedOperationException();
    }
    public final void insert (field field, int index) {}
    throw new UnsupportedOperationException();
    }
    {} public void delete (field)
    try {}
    Super.Delete (Field);
    } catch (Exception ex) {}
    System.out.println (ex. ToString());
    }
    }
        
    public void deleteAll() {}
    try {}
    for (int i = (size) - 1; i > - 1; i--) {}
    Delete (getField (i));
    }
    } catch (Exception ex) {}
    System.out.println (ex. ToString());
    }
    }
        
    public void add (int second, String text) {}
    Super.Add (new LrcItem (second, text, getFont () .derive (0, 20, Ui.UNITS_px), Color.WHITE, 480, 0));
    }

    public final void insert (int second, String text, int index) {}
    Super.Insert (new LrcItem (second, text, getFont () .derive (0, 20, Ui.UNITS_px), Color.WHITE, 480, 0), index);
    }
        
    public int size() {}
    Return this.getFieldCount ();
    }

    }

    I had a very quick glance, I probably missed or to some things so ignore my comments, if you don't think they are correct.

    A few ' style questions:

    (1) why you substituting delete and deleteAll and using size() instead of getFieldCount().

    (2) for me, the performance benefits to count backwards in loops is over-priced - and the confusion it can cause in the coding is often overlooked.

    (3) you sublayout loop backwards and the loop count seem to do essentially the same thing, is there a reason they are separate?

    (4) I don't know that you have understood the concept of a virtual height and the height of the screen for a manager of scrolling.  Your sublayout seems to try to limit the number of fields displayed in the size of the actual scope and assume that this will continue after your currentIndex.  Take a look at this:

    http://supportforums.BlackBerry.com/T5/Java-development/implementing-a-standard-style-scrollbar-on-a...

    That said, it seems to be a problem with your maintenance of currentIndex when you remove fields. Whenever you remove the field, it will cause a sublayout, and once currentIndex is > that the number of fields on the left, your treatment will die with an output of exception of limits.  But in sublayout, not delete.

    Perhaps you could explain what you're actually trying to do with this Manager as it is is not clear to me from the code.

  • Data storage local application?

    Hi all.

    I want to store the data of the application installed on the PlayBook.

    Anyone knows where is this dedicated space and how to access?

    The main use is to use a SQLite database (but not only).

    (What is possible with the simulator at all?)

    [Edit: the message is more specific.

    Hello Julien, thanks for the reply.

    In fact I tried to use ApplicationStorage already, but I got a 3003 error: exception "file or directory does not exist.

    When I run the App in internal Flash Burrito Simulator, there is no error: the db file is correctly detected.

    But it seems that File.applicationStorage is not on the PlayBook Simulator.

    Is there a simple test to check the correct path to the App store?

    [Edit 1]

    Some news: I could verify that the ApplicationStorageDirectory is finally ok (correctly created in the card Sim PlayBook.)

    The problem actually comes from ApplicationDirectory, where I get the "source" file load in the dbFile.

    If the command "File.applicationDirectory.resolvePath("assets/MyFile.ext"); ' return something like:

    "/ mlc/sandboxes/guest/PROJECTNAME.debug.XXXXXXXXXX/app/air/assets/MyFile.ext".

    (XXXXXXXXXX seems to be the ID of the deployed project series)

    And if this file "does not exist" when I access it.

    (reminder: it works very well in the internal Flash Simulator)

    Is there a simple test to check the correct path of the deployed application. ?

    (always to research...)

    [Edit 2]

    Well, it seems that the solution was related to the embedded file (or not) during deployment.

    So I have included the file I need (xml file) in the line of command deployment, and it was found correctly on the PlayBook, using ApplicationDirectory (as described by Julian).

    Just for review, I first tried to include the 'active' comprehensive directory, with an error that results from:

    java.lang.IndexOutOfBoundsException  at java.io.ByteArrayOutputStream.write(Unknown Source)    at com.qnx.bbt.deploy.Deploy.readPackage(Deploy.java:173) at com.qnx.bbt.deploy.Deploy.verifyPackageId(Deploy.java:138) at com.qnx.bbt.deploy.Deploy.sendRequest(Deploy.java:124) at com.qnx.bbt.deploy.Deploy.run(Deploy.java:100) at com.qnx.bbt.deploy.Deploy.main(Deploy.java:73) at com.qnx.bbt.airpackager.BarAirPackager.callLauncher(BarAirPackager.java:206)   at com.qnx.bbt.airpackager.BarAirPackager.run(BarAirPackager.java:129)    at com.qnx.bbt.airpackager.BarAirPackager.main(BarAirPackager.java:78)Error: null
    

    (It may be related to a specific inside assets... file or directory size... but this isn't a big deal)

    Then, finally solved. Would be the last word: do not forget to include the 'active' files you need!

  • How can set the background of the screen

    I was going through all the thread related to this issue in this form, but could not be a good solution. I want to set the background color of the screen (main screen) and add fields on it. I found the solution for background coloring, but not fields not displayed after staining.

    With the help of the Simulator: 7290

    Code of CELITE (and jfisher) to blackberryforums.com
    http://www.BlackBerryForums.com/developer-forum/89940-mainScreen-background-color.html

    class ExtendedCustomMainScreen extends CustomMainScreen {}
    {ExtendedCustomMainScreen()}
    Super();
    Rtf RichTextField = new RichTextField ("This is a readonly textfield", Field.READONLY);
    LabelField helloWorld = new LabelField ("Hi jfisher! ');
    Add (rtf);
    Add (helloWorld);
    }
    }

    class CustomMainScreen extends form {}

    Private VerticalFieldManager _container;

    {CustomMainScreen()}
    Super (Manager.NO_VERTICAL_SCROLL |) Manager.NO_VERTICAL_SCROLLBAR);
    setTitle ('Test');

    VerticalFieldManager internalManager = new VerticalFieldManager (Manager.NO_VERTICAL_SCROLL |) Manager.NO_VERTICAL_SCROLLBAR) {}
    {} public void paintBackground (Graphics g)
    g.Clear ();
    Color int = g.getColor ();
    g.setColor (0xc0dce0);
    g.fillRect (0, 0, Display.getWidth (), Display.getHeight ());
    g.setColor (color);
    }
    protected void sublayout (int maxWidth, maxHeight int) {}
    Field titleField = getMyTitleField();
    int titleFieldHeight = 0;
    If (titleField! = null) {}
    titleFieldHeight = titleField.getHeight ();
    }

    int displayWidth = Display.getWidth (); I would probably make these global
    int displayHeight = Display.getHeight ();

    Super.sublayout (displayWidth, displayHeight - titleFieldHeight);
    setExtent (displayWidth, displayHeight - titleFieldHeight);
    }

    };
    _container = new VerticalFieldManager (Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR);
    internalManager.add (_container);
    Super.Add (internalManager);
    }

    public void add (field) {}
    _container. Add (field);
    }

    {} private field getMyTitleField()
    Delegated official = getDelegate();
    Field titleField = null;
    try {}
    titleField = delegate.getField (0);
    }
    {} catch (IndexOutOfBoundsException ioobe)
    //
    }
    Return titleField;
    }
    }

    class MainScreenWithBackgroundMain extends UiApplication {}

    Public Shared Sub main (String [] args) {}
    MainScreenWithBackgroundMain app = new MainScreenWithBackgroundMain();
    app.enterEventDispatcher ();
    }

    {MainScreenWithBackgroundMain()}
    Screen ExtendedCustomMainScreen = new ExtendedCustomMainScreen();
    pushScreen (screen);
    }
    }

  • navigationMovement puzzle

    I write my own field Manager to display a grid of 6 x 10 fields. The first column is not active (done via the individual fields), and I try to have thefocus wrap around the screen. For example, if move you to the right of the last column, focus should move to the 2nd column. In other words, I want 1-5 fields below to behave like a circle under the left-right movement.

    [ X ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]

    Up and down should behave like in a regular gridfieldmanager. For various other reasons, subclassing the GridFieldManager is not an option, so I'm subclassing Manager directly. I have this scrolling behavior works correctly. the problem arises when the focus would let the Manager. If I pressed ENTER, the default scrolling down works perfectly. When I scroll with the wheel, however, development is blocked in the first and last lines. This scrolling down with the emphasis on the field (line 9, column 4) doesn't help, as does the scroll upward on the ground (row 0, col 2).

    I thought to use getManager (.navigationMovement), but it is protected.

    My navigationMovement method:

    protected boolean navigationMovement(int dx, int dy, int status, int time){    int index = getFieldWithFocusIndex();
    
        while(index >= 0 && index < getFieldCount()){        if (dx*dx > dy*dy){ // horizontal motion            if(dx < 0){ // left                index += (index%cols == 1) ? cols - 2 : - 1;            } else{ // right                index -= ((index+1)%cols == 0) ? cols - 2 : -1;            }        }else{ // vertical motion            if(dy > 0){ // down                index += cols;            } else{ // up                index -= cols;            }        }
    
            if(index < 0 || index >= getFieldCount()) return false;        try{            getField(index).setFocus();            return true;        } catch (IndexOutOfBoundsException ioobe) {            // We hit a blank spot, cycle again        }    }    return false;}
    

    Thanks in advance!

    So this is my attempt to help moveFocus. As it does not keep track of direction or whatever it is, I guess you meant to call me from navigationMovement. It worked perfectly, except that I had to manually scroll Senior Manager, whenever the target subfield was outside the visible area. Here is my solution (which also fixed another problem: the old method scrolls with a single click; now most big dx and dy lead to more scrolling).

    protected boolean navigationMovement(int dx, int dy, int status, int time){    int index = getFieldWithFocusIndex();    int oldCol = index % cols; // index = row * cols + col
    
        dx = dx % (cols - 1) + cols - 1; // force dx positive    int newCol = (oldCol - 1 + dx) % (cols - 1) + 1;    int delta = newCol - oldCol + (cols - 1) * dy;
    
        delta = moveFocus(delta, status, time);    if(delta == 0) {        Manager mgr = getManager();        XYRect rect = new XYRect();        mgr.getFocusRect(rect);        int vscroll = mgr.getVerticalScroll();        int height = mgr.getVisibleHeight();
    
            if( rect.y < 0 ) { // scrolled above visible region            mgr.setVerticalScroll((int)Math.max( 0,                         vscroll + 3 * rect.y));        } else if ( rect.Y2() > height ) { // scrolled below screen edge            mgr.setVerticalScroll((int)Math.min(                    mgr.getVirtualHeight(),                    3 * (rect.Y2() - height) + vscroll));        }    }    return (delta == 0);}
    

    Thank you very much!!

  • Problem with the playback of the ToDo of ToDoList items

    Hello

    I'm at the end with my knowledge about a problem when I try to read some fields from the list of ToDo and ToDo native application.

    I don't have a problem to read for example the name of a ToDo item with the following code:

    String taskName = task.getString(ToDo.SUMMARY, PIMItem.ATTR_NONE);
    

    But when I try to read the finished field, I always get and IndexOutOfBoundsException. The reason is that I am doing something wrong with the index, the second attribute. Here is the code:

    boolean taskStatus = task.getBoolean(ToDo.COMPLETED, 0);
    

    I found examples how to create a new item Todo, but how do I read a Boolean value in the ToDo list?

    I'm at the end with my knowledge, maybe someone of you can help me, thank you already in advance


  • 9800 tilt - screen drawing problem?

    I did a screen with custom graphics, it works perfectly normal up-side-face upward, however when I tilt the Simulator or even a real device to the left or right screen becomes white and no fields or graphics on the screen are displayed.

    Interestingly, if I start the app when the Simulator is already left-coast-to the top then the screen is however as soon as I drew with the fields etc., tili unit right-side-up top, the same thing once again, a white screen. If I restart the device in the top left-side-up mode and tilt in top-side-to the top of the screen works in the high-side-to the top, but after the back passage to left-side-to top (the State that the application started first) again a white screen.

    Does anyone else has met?

    This is my custom screen (if it's useful)

    package screens;
    
    import java.util.Random;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class CustomLoadingScreen extends MainScreen {
    
        private VerticalFieldManager _container;
        //public int displayWidth = Display.getWidth();
        //public int displayHeight = Display.getHeight();
        public CustomLoadingScreen() {
            super( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR );
    
            VerticalFieldManager internalManager = new VerticalFieldManager( Manager.NO_VERTICAL_SCROLL | Manager.NO_VERTICAL_SCROLLBAR ) {
    
                public void paintBackground(Graphics g) {
                    int[] bitArray = new int[36];
                    int color1 = 0xFFFF00AA;
                    int color2 = 0xFFBBCC00;
                    int color3 = 0xFF12BBEE;
    
                    for (int i = 0;i < bitArray.length; i += 3) {
                    bitArray[i] = color1;
                    bitArray[i + 1] = color2;
                    bitArray[i + 2] = color3;
                    }
    
                    Bitmap image = new Bitmap(6, 6);
                    image.setARGB(bitArray, 0, 6, 0, 0, 6, 6);
            g.drawBitmap(0,0,6,6,image, 0,0);
            g.setColor(0x3498CC);
            g.fillArc(0, 0, 100,100, 360, 360);
            super.paint(g);
                }
    
        protected void sublayout( int maxWidth, int maxHeight ) {
                        Field titleField = getMyTitleField();
                        int titleFieldHeight = 0;
                        if ( titleField != null ) {
                            titleFieldHeight = titleField.getHeight();
                      }
    
                    super.sublayout( Display.getWidth(), Display.getHeight() - titleFieldHeight );
                    setExtent( Display.getWidth(), Display.getHeight() - titleFieldHeight );
                }
    
            };
            _container = new VerticalFieldManager( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR );
            internalManager.add( _container );
            super.add( internalManager );
        }
    
        public void add( Field field ) {
            _container.add( field );
        }
    
        private Field getMyTitleField() {
            Manager delegate = getDelegate();
            Field titleField = null;
            try {
                titleField = delegate.getField( 0 );
            }
            catch ( IndexOutOfBoundsException ioobe ) {
    
            }
            return titleField;
        }
    
    }
    

    You don't need to invalidate - the system redraws after a re-layout anyway.

    What to use as values for width and height - only maxWidth and maxHeight spent in your sublayout are correct. getPreferredWidth and getPreferredHeight are still useless. getWidth() and getHeight() return the previous values, since you have not called setExtent with new values yet. Same problem with getVisibleWidth / getVisibleHeight. Oh and by the way, you cannot use correctly titleField.getHeight () at this point as well.

    However, the irony is that you don't need all these shenanigans in your program. Instead of making your first the 'title' field, don't add it to the screen at all and just use setBanner / setTitle on it. You will be able to abandon this override of sublayout in total.

    Read the following article in the knowledge base to greatly simplify your code:

    Screen explained

    Oops - just found another problematic piece of code: why any who call the super.paint inside paintBackground? Drop this last line, and you'll be much better off. It could well be the root of your problem.

    Also - for efficiency, not to generate your image Bitmap every time by the paintBackground - do once in the constructor and use it whenever you need.

  • Launch my application by clicking on the link

    I have the INDEXOUTOFBOUND exception when executing the code that follows my, this because I need to extract the clicked url parameters and the openFilter method is called twice: the first time, the "name" parameter is the url of the user has clicked, but then it turns into a different url and I can't retrieve my params.

      public Connection openFilter( String name, int mode, boolean timeouts ) throws IOException
        {
    
            DialogHelper.ShowDialog("Connection");
            String param1 = "143.225.229.136";
            int index = name.indexOf("=");
            String param2 = name.substring((name.lastIndexOf('?'))+1,index);
            String param3 = name.substring(index+1,name.indexOf(';'));
            ApplicationManager manager = ApplicationManager.getApplicationManager();
    
            //Check to see if application is running.
            ApplicationDescriptor descriptors[];
            ApplicationDescriptor descriptor;
            /*//Retrieve the name of a running application.
            descriptors = manager.getVisibleApplications();
            for (int i = 0; i < descriptors.length;i++) {
                descriptor = descriptors[i];
                if (descriptor.getName().equals( "Meetecho" )) {
                    manager.requestForeground( manager.getProcessId( descriptor ) );
                    return null;
                }
            }*/
            int codeModuleHandle = CodeModuleManager.getModuleHandle("Meetecho");
            descriptors = CodeModuleManager.getApplicationDescriptors(codeModuleHandle);
            descriptor = new ApplicationDescriptor(descriptors[0],new String[]{param1,param2,param3});
            try {
                ApplicationManager.getApplicationManager().runApplication( descriptor );
                } catch (ApplicationManagerException e) {
                // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            // Failed to open the sub connection
            return null;
        }
    

    I've solved

    public Connection openFilter( String name, int mode, boolean timeouts ) throws IOException
        {
            synchronized(Application.getEventLock()) {
            DialogHelper.ShowDialog("Connection");
            String param1 = "143.225.229.136";
            String param2,param3;
            try{
            int index = name.indexOf("=");
             param2 = name.substring((name.lastIndexOf('?'))+1,index);
             param3 = name.substring(index+1,name.indexOf(';'));
            }catch(IndexOutOfBoundsException e){
                return null;
            }
            ApplicationManager manager = ApplicationManager.getApplicationManager();
    
            //Check to see if application is running.
            ApplicationDescriptor descriptors[];
            ApplicationDescriptor descriptor;
            /*//Retrieve the name of a running application.
            descriptors = manager.getVisibleApplications();
            for (int i = 0; i < descriptors.length;i++) {
                descriptor = descriptors[i];
                if (descriptor.getName().equals( "Meetecho" )) {
                    manager.requestForeground( manager.getProcessId( descriptor ) );
                    return null;
                }
            }*/
            int codeModuleHandle = CodeModuleManager.getModuleHandle("Meetecho");
            descriptors = CodeModuleManager.getApplicationDescriptors(codeModuleHandle);
            descriptor = new ApplicationDescriptor(descriptors[0],new String[]{param1,param2,param3});
            try {
                ApplicationManager.getApplicationManager().runApplication( descriptor );
                } catch (ApplicationManagerException e) {
                // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            // Failed to open the sub connection
            return null;
            }
        }
    
  • To access the news PIM works on OS 4.2-4.5 but fails on OS 4.6

    I use this code to access the information memo on 8800 4.2 and 4.5 8800 and it works but when I use it on flat bead with 4.6 I get a 'java.lang.IndexOutOfBoundsException"when it is called custom MenuItem that I added in memo app.

    //Run is called when the custom menuItem is invoked
    
    BlackBerryMemo memo;
    
    public Object run(Object context){  //context object should be a memo         if (context instanceof BlackBerryMemo)   {        try{                _myBuffer.append("Notes ID: " + memo.getString( BlackBerryMemo.UID, 0 ) + "\r\n" );}  catch (Exception e) {System.out.println(e);}   }   return context;}
    

    The strange thing is that if I use this code:

    _myBuffer.append("Notes ID: " + memo.getString( BlackBerryMemo.UID, 0 ) + "\r\n" );
    

    in a regular application of CLDC "don't not using custom menu" the same code works on the flat bead.

    someone at - it a similar experience?

    Ugh... Add this code works:

    if ( memo.countValues( BlackBerryMemo.UID ) > 0 )
    {
       _myBuffer.append("Notes ID: " + memo.getString( BlackBerryMemo.UID, 0 ) + "\r\n" );
    }
    

Maybe you are looking for

  • Apple Watch reboot

    My iphon more 6 s and my Apple Watch are both on the last update. Whenever I get a notification of text on my watch, it resets.

  • could we have a * filter * option to play a sound?

    I'm bored of Eudora. I had a sound for each of my clients, so I knew that to get up and come to answer them. I know that we have a framework to play a sound when * any * message arrives, and I have this job very well.But if I had a filter option, as

  • Help with Itune

    I can not d/l itunes... was a workng perfect until I upgraded... now, he get a window says that Data Execution Prevention does not allow me to use?  I contacted itunes support and they can not help! Help!

  • New switches to 1 G of S series

    Hi all I want to ask about the new S series switches. comparing them with the N series, I see almost no difference even rising same debit and all specifications are almost the same, then what is the purpose of these series in design and new implement

  • Help on recovering database /Restore - no available controlfiles kccpb_sanity_check_2 control file sequence number mismatch

    Hi all.I really need your help on this:(1) version: 11.2.0.1 EE / Windows.(2) database does not start, don't get database.Alert.log info:Instance of stopped by USER, pid = 36522015-11-22 15:57:19.763000 - 04:30I found this after using adrci:2015-11-2