How to get the element selected listfield and goto next page?

Assalaamualikum

I try parsing the XML from a url and show in listfield.

problem:

How to get the selected item and passing the variable and than goto next page?

my code:

package parsepack;

import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;

Import javax.microedition.io.Connector;
Import javax.microedition.io.StreamConnection;

Import net.rim.device.api.system.Bitmap;
Import net.rim.device.api.system.Display;
Import net.rim.device.api.ui.DrawStyle;
Import net.rim.device.api.ui.Field;
Import net.rim.device.api.ui.FieldChangeListener;
Import net.rim.device.api.ui.Graphics;
Import net.rim.device.api.ui.Manager;
Import net.rim.device.api.ui.UiApplication;
Import net.rim.device.api.ui.component.ListField;
Import net.rim.device.api.ui.component.ListFieldCallback;
Import net.rim.device.api.ui.container.MainScreen;
Import net.rim.device.api.ui.container.VerticalFieldManager;
Import net.rim.device.api.xml.parsers.DocumentBuilder;
Import net.rim.device.api.xml.parsers.DocumentBuilderFactory;

to import org.W3C.DOM.document;
Import org.w3c.dom.Node;
Import org.w3c.dom.NodeList;

extends xmlparsing public class UiApplication implements ListFieldCallback, FieldChangeListener
{

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

public long mycolor;
Connection _connectionthread;
private static ListField _list;
private static Vector listElements is new Vector();.
public display display = new MainScreen();
MainManager VerticalFieldManager;
VerticalFieldManager subManager;

public xmlparsing()
{
Super();
pushScreen (screen);

final Bitmap Imagearriereplan = Bitmap.getBitmapResource ("blackbackground.png");

mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL |) Manager.NO_VERTICAL_SCROLLBAR)
{

public void paint (Graphics graphics)
{
graphics.drawBitmap (0, 0, Display.getWidth (), Display.getHeight (), Imagearriereplan, 0, 0);

Super.Paint (Graphics);
}

};

subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL |) Manager.VERTICAL_SCROLLBAR)
{
protected void sublayout (int maxWidth, maxHeight int)
{
int displayWidth = Display.getWidth ();
int displayHeight = Display.getHeight ();

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

Screen.Add (mainManager);

_list = new ListField()

{

public void paint (Graphics graphics)

{
graphics.setColor ((int) mycolor);
Super.Paint (Graphics);

}

};
myColor = 0x00FFFFFF;
_list. Invalidate();
_list.setEmptyString ("* only supplies not available *", DrawStyle.HCENTER "");
_list.setRowHeight (50);
_list.setCallback (this);
mainManager.add (subManager);
listElements.removeAllElements ();
_connectionthread = New Connection();
_connectionthread. Start();
}

protected boolean navigationClick (int status, int time)
{
Try
{
Here, go to another screen if you need.

}
catch (System.Exception e)
{
System.out.println ("Exception:-: navigationClick()" + try ());
}
Returns true;
}

private class login extends thread
{
Public connection()
{
Super();
}

public void run() {}
Doc document;
StreamConnection conn = null;
InputStream is = null;
try {}

Conn = Connector.open (StreamConnection) ("http://ec2-54-248-241-248.ap-northeast-1.compute.amazonaws.com/koperasi-akr-trial/cgi-bin/gw-pinjama...

DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance ();
docBuilderFactory.setIgnoringElementContentWhitespace (true);
docBuilderFactory.setCoalescing (true);
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder ();
docBuilder.isValidating ();
is = conn.openInputStream ();
doc = docBuilder.parse (is);
doc.getDocumentElement () .normalize ();
List of NodeList = doc.getElementsByTagName ("ID");
for (int i = 0; i)< list.getlength();="" i++)="">
Node node = list.item (i) .getFirstChild ();
listElements.addElement (textNode.getNodeValue ());
}
} catch (Exception e) {}
System.out.println (try ());
} {Finally
If (is! = null) {}
try {is.close ();
} catch (IOException ignored) {}
} If (conn! = null) {}
Try {conn.close () ;}
catch (IOException ignored) {}
}} UiApplication.getUiApplication () .invokeLater (new Runnable() {}
public void run() {}
_list. SetSize (listElements.Size ());
subManager.add (_list);
Screen.Invalidate ();
}
});
}

}

' public void drawListRow (list ListField, Graphics g, int index, int y, int w)
{
Your string = (String) listElements.elementAt (index);
int yPos = 0 + y;
g.drawLine (0, yPos, w, yPos);
g.drawText (, 5, 15 + y, 0, w);
}

public {get {Object (ListField list, int index)
{
Return listElements.elementAt (index);
}
public int indexOfList (String prefix, ListField list, int, string)
{
Return listElements.indexOf (prefix, string);
}
public int getPreferredWidth (ListField list)
{
Return Display.getWidth ();
}
public final void insert (String toInsert, int index) {}
listElements.addElement (toInsert);
}

' Public Sub fieldChanged (field field, int context) {}

}
}

Thank you.

I told you that replace the navigationclick() method where initialize you your listfield

as I think that changing your code and then answer me

_list = new ListField()
{
protected boolean navigationClick(int status, int time)
{
  Dialog.inform("hi");
  return true;
}

public void paint(Graphics graphics)
{
graphics.setColor((int) mycolor);
super.paint(graphics);
}
};

Tags: BlackBerry Developers

Similar Questions

  • How to get the message to debug all to running page request OFA?

    Hello

    How to get the message to debug all to running page request OFA? do not use JDeveloper

    Thank you

    Renon,

    this.writeDiagnostics will be work AM and not CO. You mentioned that your code is AM, which is why I give (this.writeDiagnostics).

    You get an error when you use what to ? AM

    in CO, you must use pageContext. writeDiagnostics();

    You don't need to put any profile (other than DNF: Diagnostics), you just need to go to the Diagnostics - select the log on screen and choose the level that you used in the writeDiagnostics method.

    See you soon

    AJ

  • How to get the items selected from indesign Document?

    Hi all

    I'm trying to get the objects selected by the user in the indesign document, to which the following code, I wrote, but his does not collect do not.

    LayoutTarget InterfacePtr < ILayoutTarget > (myContext, UseDefaultIID());

    if (layoutTarget == nil)

    {

    () CAlert::ErrorAlert

    "layouttarget sucks" );

    breaking ;

    }

    UIDList itemList = layoutTarget-> GetUIDList (kStripStandoffs);

    where mycontext is IActiveContext and after getting the itemlist (all managers of related texts).

    How to perceive the limits of the textframe? (TopLeft, TopRight, BottomLeft, BottomRight).

    Thanks and greetings

    Sanjeev.k

    You must initialize the ILayoutTarget with a CSB. As

    InterfacePtr iLayoutCSB (iSelectionManager-> QueryConcreteSelectionBoss (kNewLayoutSelectionBoss));

    InterfacePtr layoutTarget (iLayoutCSB, UseDefaultIID());

    HTH.

    Jasmine

  • Chart WPF: How to get the limits of PlotArea and axes

    I can't find explicit methods to get limits of PlotArea and axes.

    Please let me know workarounds if they are available. Actually a post explains how to get the PlotArea limits using RangeCursor. Are there alternative means for shafts?

    The photo below shows what I did in WinForms with the methods GetBounds and HitTest. I would like to draw the ornaments on the chart in WPF.

    I have attached a code example of this look ornaments around the plot area and the scales.

    Note that this relies on implementation details of the current version of WPF controls for the ornaments of the scale, as it was more effective than gradually points to test in the graph using the GetScaleAt method. We have intentionally left much of the underlying primitive types with a minimum documentation, like us they have changed in the past and may change in the future. Although these exact members can be removed in a future release, we do not expect to provide an equivalent function and stabilize the primitive API over time.

  • How to get the value of viewattribute and how to assign the text field. URG

    Hi all,
    I created messagestyled text programmatically and I want the value of viewAttribute.
    I don't know how to define the instance of the view and display attribute.

    I tried this way, it is what is called the vo class but after that i dnt know how to set

    Here the code that I used...

    (1) I create the messagestyled text
    OAFormattedTextBean cctextbean = (OAFormattedTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, FORMATTED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCText");

    OAMessageStyledTextBean ccidbean = (OAMessageStyledTextBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, MESSAGE_STYLED_TEXT_BEAN, OAWebBeanConstants.VARCHAR2_DATATYPE, "CCId");

    (2) and I called the view object
    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");

    (3) I want to set the view instance and viewattribute using code. This stage i dnt know how to define.

    (4) I want to know, how to get the value of the attribute to display and how to set the value to the messagestyled text field.

    I'm new to OFA. It's Urgent.

    Thanks in advance
    Fabrice

    Hello

    use
    Import oracle.jbo.Row;

    OAViewObject ccview = (OAViewObject) AM.findViewObject ("CmpnyDetVO1");
    Line line (Row) = ccview.first ();
    Test String = (String) row.getAttribute ("");

    then to set the value of the text of messagestyled

    OAMessageStyledTextBean bean = (OAMessageStyledTextBean) webBean.findindexedchildrecursive ("CCId");
    bean.setText (test);

    Thank you
    Gerard

    Published by: Gauravv on August 4, 2009 09:38

  • How to get the current selected action.

    Hello

    I would get the currently selected action.

    Please refer to the image below. Vignette (selection) is selected.

    Is there a script that I could use to get the which?

    Your help is very appreciated.

    Untitled-1.jpg

    getSelectedAction()
    function getSelectedAction(){
        var ref = new ActionReference();
        ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
        try{
            var desc = executeActionGet(ref);
        }catch(e){ return; } // no action selected
        var selectedName = desc.getString(charIDToTypeID("Nm  "));
        var selectedIndex = desc.getInteger(charIDToTypeID("ItmI"));
        var parentName = desc.getString(charIDToTypeID("PrNm"));
        var parentIndex = desc.getInteger(charIDToTypeID("PrIn"));
        if(isActionSet( parentIndex, parentName )){
            var setName = parentName;
            var actionName = selectedName;
        }else{
            var setName = findAction(parentIndex, parentName );
            var actionName = parentName;
        }
        return [setName,actionName];
    };
    function isActionSet( parentIndex, parentName ){
       var res = false;
       try{
          var ref = new ActionReference();
          ref.putIndex( charIDToTypeID( "ASet" ), parentIndex );
          var setName = executeActionGet( ref ).getString(charIDToTypeID("Nm  "));
          if(setName == parentName) res = true;
       }catch(e){}
       return res;
    };
    function findAction(parentIndex, parentName ) {
      var i = 1;
      var found = false;
      while (!found) {
        var ref = new ActionReference();
        ref.putIndex(charIDToTypeID('ASet'), i);
        var desc;
        try {
          desc = executeActionGet(ref);
        } catch (e) {
          break;
        } finally {
        }
        if (desc.hasKey(charIDToTypeID('Nm  '))) { ;
          var setName = desc.getString(charIDToTypeID('Nm  '));
            var ref = new ActionReference();
            ref.putIndex(charIDToTypeID('Actn'), parentIndex);
            ref.putIndex(charIDToTypeID('ASet'), i);
            try{
            var adesc = executeActionGet(ref);
            var actName = adesc.getString(charIDToTypeID('Nm  '));
            if(actName==parentName) return setName;
            }catch(e){}
          }
        i++;
        }
    };
    
  • How to get the element highlight DataGrid?

    Hello everyone...

    I've already looked in a lot of sites and forums, and I can't find anything...

    I need to get data on the element (not selected) highlighted on my DataGrid (I intend to use the MouseOver event)...

    does anyone have an idea on how to do it?

    PS Sorry for the grammar errors... my English is not very good...

    Hello

    Add an event listener for the itemRollOver event of the datagrid to get the index of the item highlighted.

    
    
    protected function dataGrid_itemRollOverHandler(event:ListEvent):void
    {
         var item:Object = dataGrid.dataProvider[event.rowIndex];
    }
    
  • Satellite L670-143 how to get the language selection during recovery?

    Hello

    I just started my L670 for the first time today, I'm Dutch speaking so I chose "Dutch" (Nederlands) as the language of the interface for my Win7 installation. Shortly after installation, I noticed that the usual folders that I have on my main PC (English) were not there,

    instead of the file * / Users / * we created a folder * / Gebruikers / *.

    Because I like to copy a lot of files / preferences of applications from my main PC to the laptop and I'm not comfortable with the Dutch interface, I would like to also the English interface.
    For this purpose, I decided to do the system restore to choose English as the main language just as it is on my main PC, taking * 0 * when starting, select F8, click the method of complete recovery from Toshiba, but now I can no longer choose between * Dutch/French/English * as the language of the main interface and it installs automatically with the Dutch language.

    How can I do the complete factory restore then I have the choice of the language back, so I can install English please?

    Please, if anyone knows how I can get back the language selection of interface with the Toshiba recovery method?

    Hello

    As far as I know, you can choose the language of the system only once at the start of the laptop for the first time.

    I think this laptop model was launched in three different countries and that's why you can choose your preferred language for the first time. After that, the selected language will still be available on the HARD disk, but other languages would be disabled.

    Maybe you can order a disk recovery in English from here:
    https://backupmedia.Toshiba.EU/landing.aspx

    Welcome them

  • How to get the difference of current and previous line for a column of the same table?

    Hello

    I have a table where there are 3 rows and say 2 columns only, as below

    Col1               | Col2
    --------------------- |----------------------------------------

    first_flag |  100

    second_flag |  104

    third_flag |  110

    Now, using sql, which accepts a parameter col1, how do I get the bottom o/p

    say that the entry is second_flag,

    output must be

    second_flag, 104, 4 (4 being the difference between 104 and 100)

    If I give the entry like third_flag, the output should be

    third_flag, 110, 6 (6 is the difference between 110 and 104)

    Any help?

    Hello

    Another way is to use the analytic LAG function:

    WITH got_diff AS

    (

    SELECT col1, col2

    , col2 - LAG (col2) over (ORDER BY col1) AS diff

    OF mydata

    )

    SELECT *.

    OF got_diff

    WHERE col1 =: flag_wanted

    ;

    This assumes that the lines are in alphabetical order by col1.  If the order is something else, then use it in the ORDER BY clause analytical.

  • How to get the customer name, UUID, and cluster comments

    Hello

    I was wondering if somone could show me how to tie somethings together. I can get a VM UUID, I can get the names of the virtual machines and the cluster on which they sit, but I'm having a hard time getting all 3 into a single csv report. All the world is that who could share? Thank you!

    Try this

    Get - VM | Select Name,@{N="UUID; E={$_. ExtensionData.Config.Uuid}},@{N="Cluster '; E={($_ | Get - Cluster). Name}}

  • How to get the count of UUTPassed and UUTFailed of c# ActiveX control

    Hello

    My operator interface use the TestStand ActiveX in c# control. I'll use the OP to a bench of EHR, which runs the same file in sequence. I would like to know the total UUT-tested, UUTPassed and UUTFailed count after each HAD tested. Is there built-in parameters does the work for me and how can I get it? If there is not, I have to create internal variables in c# to do the job.

    Thank you

    Kind regards

    No, there are no construction based on this. So either you have to implement something like this in on of the following:

    (a) the user interface

    (b) the SequenceFile (as long as it is not discharged in the meantime)

    (c) the process model

    (d) use an external tool for analysis

    If you already work with databases for reports, I suggest using d). If this isn't the case, you can choose. But change the process template is not recommended (if other, simple solutions are available), I would not recommend c).

    hope this helps,

    Norbert

  • How to get the Application Build Date and time?

    Hi guys,.

    I am developing application in Cascade.

    What is the API I can use to get the construction Date of the application and Tiime?

    These macros are expanded to C-strings at compile time. This is how/where to use it. Following an example would work I think:

    fprintf (stderr, "construction date is %s, construction time is %s\n", __DATE__, __TIME__);

  • How to get the driver network card and on the use of the PowerCLI firmware version?

    Hi all

    I would like to know if anyone can help me in sharing the PowerCLI script to list the server NETWORK card driver and the firmware version?

    Note: I use the HP Blade Server and it's manual ESX - CLI command output:

    HP BL 465c G8
    ~ # ethtool-i vmnic0
    pilot: be2net
    version: 10.5.65.4
    firmware version: 10.2.340.19
    bus-info: 0000:04:00.0

    HP BL 465c G7
    ~ # ethtool-i vmnic0
    pilot: be2net
    version: 10.2.293.0
    firmware version: 4.9.416.7
    bus-info: 0000:04:00.0

    Any kind of help would be greatly appreciated.

    Thank you.

    PowerCLI Version

    ----------------

    VMware vSphere PowerCLI 6.0 Release 2 build 3056836

    ---------------

    Component versions

    ---------------

    VMWare AutoDeploy PowerCLI component 6.0 build 2358282

    VMWare ImageBuilder PowerCLI component 6.0 build 2358282

    VMware vSphere PowerCLI component 6.0 build 3052101

    It works for you?

    $esxName = "MyEsx".

    $esxcli = get-EsxCli - VMHost $esxName

    $esxcli.network.nic.list () | %{

    $esxcli.network.nic.get ($_.) Name) |

    Select Name,

    @{N = "Driver"; E={$_. DriverInfo.Driver}},

    @{N = 'Version'; E={$_. DriverInfo.Version}},

    @{N = 'Firmware Version'; E={$_. DriverInfo.FirmwareVersion}}

    }

  • How to get the storage allocated profile and used the plugin vCloud 5.1 Vdc

    How can I get the storage allocated and used for a Vdc in vCloud 5.1 plugin?

    VCloud plugin 1.5, there was a property of VclVdc.storageCapacity give us the space allotted, limit, use (s) and overhead costs.

    VCloud plugin 5.1 we allways null VclVdc.storageCapacity. Then VclVdc.getStorageProfiles () but presents the objects, there is that the "limit value".

    ¿WHERE are the other values?

    I have attached two screenshots. vCloud console shows the data, but not vCloud plugin.

    Thank you very much.

    Damian

    Tell me if this work. This was written in a few minutes.

    var host = vdc.getHost();
    
    var queryService = host.getQueryService();// toAdminObject().getAdminQueryService();
    
    var profs = vdc.getStorageProfiles();
    
    for each (var prof in profs) {
    
        var expression = new VclExpression(VclQueryAdminOrgVdcStorageProfileField.HREF, prof.getReference().href  , VclExpressionType.EQUALS);
        var filter = new VclFilter(expression);
        var params = new VclQueryParams();
        params.setFilter(filter);
        var resultSet = queryService.queryRecords(VclQueryRecordType.ADMINORGVDCSTORAGEPROFILE,params);
    
        while (resultSet != null) {
            var records = resultSet.getRecords(new VclQueryResultAdminOrgVdcStorageProfileRecord);
            System.log(records.length + " records found");
                for each (var record in records) {
                    //obtain data from record
                    System.log("storageUsedMB : " + record.storageUsedMB);
                    System.log("storageLimitMB : " + record.storageLimitMB);
                }
        resultSet = resultSet.getNextPage();
        }
    
    }
    
  • How to get the value selected inside the forEach loop

    Hello
    I have foreach loop with a link inside command. It looks like in below:

    * < af:forEach items = "#{PagingBean.pages}" var = "item" > * "
    * < text af:commandLink = ' #{point} "id ="cl1. "
    * actionListener = "#{PagingBean.pageLinkClicked}" / > * "
    * < af:spacer width = "10" height = "10" id = "s1" / > *.
    * < / af:forEach > *.

    where PagingBean.pages is an array of integers.
    Now the links look like this * 1 2 3 4 5 * I want to get the value of the clicked link.
    Anyone please help me to get the value of commandlinks clicked in the bean

    Hello

    How about the text in the actionListener for the clicked commandLink and process accordingly?

    Ex:

     
                           
                           
    
    
        public void pageLinkClicked(ActionEvent actionEvent) {
            // Add event code here...
            System.out.println(((RichCommandLink)actionEvent.getSource()).getText());
        }
    

    Arun-

Maybe you are looking for