BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-23-2008, 10:02 AM   #1 (permalink)
New Member
 
Join Date: Jul 2008
Model: none
PIN: N/A
Carrier: none
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Newbie First Attempt - Datacapture & Http post/push issues

Please Login to Remove!

Hi,

I'm getting an uncaught exception that im not sure how i can or am supposed to handle...?

The error im receiving you can see here (I have had to space it out as i cannot yet post links/images...?!)

http : / / www . imageshare . web . id / images / iwgqhetdoz6mxtcjbots . jpg


Please see the code below:


ConnectionThread Java File

Code:
/*
 * ConnectionThread.java
 *
 *  <your company here>, 2003-2008
 * Confidential and proprietary.
 */

package com.rim.samples.Simon_Test;

import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;

public class ConnectionThread extends Thread {

    private boolean start = false;

    private boolean stop = false;

    private String url;

    private String data;

    public boolean sendResult = false;

    public boolean sending = false;

    public void run() {
        while (true) {
            if (start == false && stop == false) {
                try {
                    sleep(200);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            } else if (stop) {
                return;
            } else if (start) {
                httpPost();
            }
        }
    }

    private void httpPost() {
        HttpConnection conn = null;
        OutputStream out = null;
        int responseCode;

        try {
            conn = (HttpConnection) Connector.open(url);
            conn.setRequestMethod(HttpConnection.POST);
            out = conn.openOutputStream();
            out.write(data.getBytes());
            out.flush();
            responseCode = conn.getResponseCode();

            if (responseCode != HttpConnection.HTTP_OK) {
                sendResult = false;
            } else {
                sendResult = true;
            }
            start = false;
            sending = false;

        } catch (IOException e) {
            start = false;
            sendResult = false;
            sending = false;
        }

    }

    public void post(String url, String data) {
        this.url = url;
        this.data = data;
        sendResult = false;
        sending = true;
        start = true;
    }

    public void stop() {
        stop = true;
    }

}


Lombard Fava File

Code:
package com.rim.samples.Simon_Test;

import net.rim.device.api.ui.UiApplication;
import com.rim.samples.Simon_Test.LombardScreen;
import com.rim.samples.Simon_Test.ConnectionThread;

public class Lombard extends UiApplication {

    private LombardScreen screen;

    private ConnectionThread connThread = new ConnectionThread();

    public Lombard() {
        connThread.start();
        screen = new LombardScreen(connThread);
        pushScreen(screen);
    }

    public static void main(String[] args) {
        Lombard uiApp = new Lombard();
        uiApp.enterEventDispatcher();
    }

}

Lombard Java File:

Code:
package com.rim.samples.Simon_Test;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;
import net.rim.device.api.i18n.*;

import com.rim.samples.Simon_Test.ConnectionThread;

public class LombardScreen extends MainScreen
{

/* -------------------------------------------------------------------------------------- */

/*
-------------------------------------------
-------------------------------------------
!! DECLARING !!
-------------------------------------------
-------------------------------------------
*/

protected boolean sending = false;

private ConnectionThread connThread;

//Client Name
private BasicEditField clientNameText =
    new BasicEditField("", "", 250 ,
    BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Age
private EditField ageValue =
new EditField("", "", 3,
EditField.FILTER_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Gender
private ObjectChoiceField genderChoice =
new ObjectChoiceField("", 
new String[]
{"Male", "Female"});

//Product name
private BasicEditField prodNameText =
new BasicEditField("", "", 500, BasicEditField.USE_ALL_WIDTH | BasicEditField.NO_NEWLINE);

//Name Object Choice Field
private ObjectChoiceField partnerNameChoice =
new ObjectChoiceField("", 
new String[]
{"Partner 1", "Partner 2", "Partner 3", "Partner 4", "Partner 5",
 "Partner 6", "Partner 7", "Partner 8", "Partner 9", "Partner 10",
 "Partner 11", "Partner 12", "Partner 13", "Partner 14", "Other"}, 0);

//Name Text Field 
 private BasicEditField partnerNameText =
 new BasicEditField("", "", 150,
 BasicEditField.USE_ALL_WIDTH | BasicEditField.NO_NEWLINE);

//Address
private AutoTextEditField addressText =
new AutoTextEditField("", "");

//Telephone Number
private BasicEditField telNumberText =
new BasicEditField("", "", 15,
BasicEditField.USE_ALL_WIDTH | BasicEditField.NO_NEWLINE | BasicEditField.FILTER_PHONE);

//Can the investment to be in Goldlist?
private ObjectChoiceField goldlistChoice =
new ObjectChoiceField ("",
new String[]
{"No", "Yes"}, 0);

//Broker Initial Commission
private EditField initialCommValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Allocation Rate
private EditField allocationRateValue =
new EditField("", "100.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Bid/Offer Spread
private EditField bidOfferSpreadValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Guaranteed Administration Charge Value
private EditField adminChargeValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Guaranteed Administration Charge Months
private EditField monthsAdminChargeValue =
new EditField("", "60", 3,
EditField.FILTER_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);                                

//Underlying asset charges (e.g. on mutual fund)A
private EditField assestChargeAValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Underlying asset charges (e.g. on mutual fund)B
private EditField assestChargeBValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);
                
//Renewal Commission
private EditField renCommissionValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);        

//Investment Advisory Fee
private EditField AdFeeValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Establishment Charge - Value
private EditField estChargeValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);                

//Establishment Charge - Months
private EditField monthsEstChargeValue =
new EditField("", "60", 3,
EditField.FILTER_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Establishment Charge - Choice
private ObjectChoiceField premfunEstChargeChoice =
new ObjectChoiceField ("",
new String[]
{"Premium", "Fund"}, 0);

//Policy Fee
private EditField policyFeeValue =
new EditField("", "418", 12,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Surrender penalty (value not year dependent) - Value
private EditField surrPenValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Surrender penalty (value not year dependent) - Months
private EditField monthsSurrPenValue =
new EditField("", "60", 3,
EditField.FILTER_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Surrender penalty (value not year dependent) - Choice
private ObjectChoiceField premfunSurrPenChoice =
new ObjectChoiceField ("",
new String[]
{"Premium", "Fund"}, 0);

//Surrender Penalty at end of year t - Value
private EditField surrPenEoyValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Surrender Penalty at end of year t - Value2
private EditField perOfPremiumSurrPenEoyValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Trailer fee to LIA (for sales margin check):
private EditField trailerFeeValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Premium
private EditField premiumValue =
new EditField("", "10000", 20,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Premium Currency
private ObjectChoiceField currencyChoice =
new ObjectChoiceField ("",
new String[]
{"ARP", "ATS", "AUD", "BEF", "CAD", "CHF", "DEM",
 "DKK", "ESP", "EUR", "FIM", "GBP", "FRF", "GRD",
 "IEP", "ITL", "JPY", "LUF", "NLG", "NOK", "NZD",
 "PTE", "SEK", "USD", "ZAR"}, 11);

//Premium Frequency
private ObjectChoiceField premFreqChoice =
new ObjectChoiceField ("",
new String[]
{"Single", "Monthly", "Quarterly", "Twice Yearly", "Annually"}, 0);

//Premium Term (only for non-single premium)
private EditField premTermValue =
new EditField("", "1", 3,
EditField.FILTER_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Partial Surrenders (only for single premium policies) - Value
private EditField partialSurrValue =
new EditField("", "0.00", 6,
EditField.FILTER_REAL_NUMERIC | BasicEditField.USE_ALL_WIDTH | BasicEditField.FIELD_RIGHT | BasicEditField.NO_NEWLINE);

//Taken As - Partial Surrenders (only for single premium policies) - Choice
private ObjectChoiceField takenAsPartialSurrChoice =
new ObjectChoiceField ("",
new String[]
{"Monthly", "Quarterly", "Twice Yearly", "Annually"}, 1);

private ButtonField clearButton = new ButtonField("Clear");

private ButtonField submitButton = new ButtonField("Submit");


/*
-------------------------------------------
-------------------------------------------
!! END OF DECLARING !!
-------------------------------------------
-------------------------------------------
*/


/* -------------------------------------------------------------------------------------- */


/*
-------------------------------------------
-------------------------------------------
CREATE MAIN DATA ENTRY SCREEN
-------------------------------------------
-------------------------------------------
*/

public LombardScreen(ConnectionThread connThread)
        {
                super();
                
                Font fnt = this.getFont().derive(Font.BOLD | Font.ITALIC);
                
                LabelField title = new LabelField("Lombard Demo",  LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
                setTitle(title);
                
                LabelField header1 = new LabelField("Client Details -");
                header1.setFont(fnt);
                add(header1);

                //Seperator
                add(new SeparatorField());
                add(new SeparatorField());
                
                //Client Name
                add(new LabelField("Client Name:"));
                add(clientNameText);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Age
                add(new LabelField("Age:"));
                add(ageValue);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Gender
                add(new LabelField("Gender:"));
                add(genderChoice);
                add(new LabelField(""));
                                
                //HEADER & Seperators - Product Details
                add(new LabelField(""));
                add(new SeparatorField());
                add(new SeparatorField());
                LabelField header2 = new LabelField("Product Details -");
                header2.setFont(fnt);
                add(header2);
                add(new SeparatorField());
                add(new SeparatorField());
                                
                //Product name
                add(new LabelField("Product Name:"));
                add(prodNameText);

                //HEADER & Seperators - IFA Details
                add(new LabelField(""));
                add(new SeparatorField());
                add(new SeparatorField());
                LabelField header3 = new LabelField("IFA Details -");
                header3.setFont(fnt);
                add(header3);
                add(new SeparatorField());
                add(new SeparatorField());

                //Name
                add(new LabelField("Name: (Select from list)"));
                add(partnerNameChoice);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Name
                add(new LabelField("Name:"));
                add(partnerNameText);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Address
                add(new LabelField("Address: "));
                add(addressText);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Telephone Number
                add(new LabelField("Telephone Number:"));         
                add(telNumberText);

                //HEADER & Seperators - Fund Details
                add(new LabelField(""));
                add(new SeparatorField());
                add(new SeparatorField());
                LabelField header4 = new LabelField("Fund Details -");
                header4.setFont(fnt);
                add(header4);
                add(new SeparatorField());
                add(new SeparatorField());

                //Can the investment to be in Goldlist?
                add(new LabelField("Can invest in Goldlist:"));
                add(goldlistChoice);
                
                //HEADER & Seperators - Charges
                add(new LabelField(""));
                add(new SeparatorField());
                add(new SeparatorField());
                LabelField header5 = new LabelField("Charges -");
                header5.setFont(fnt);
                add(header5);
                add(new SeparatorField());
                add(new SeparatorField());

                //Broker Initial Commission
                add(new LabelField("Broker Initial Commission:"));
                add(initialCommValue);
                add(new LabelField("% of premium"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Allocation Rate
                add(new LabelField("Allocation Rate:"));
                add(allocationRateValue);
                add(new LabelField("% of premium"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Bid/Offer Spread
                add(new LabelField("Bid/Offer Spread:"));
                add(bidOfferSpreadValue);
                add(new LabelField("% of allocated premium"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Guaranteed Administration Charge
                add(new LabelField("Guaranteed Admin Charge:"));
                add(adminChargeValue);
                add(new LabelField("% per annum of fund guaranteed for"));
                add(monthsAdminChargeValue);
                add(new LabelField("months"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                                
                //Underlying asset charges (e.g. on mutual fund)A
                add(new LabelField("Underlying asset charges (e.g. on mutual fund)A:"));
                add(assestChargeAValue);
                add(new LabelField("% per annum of fund"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Underlying asset charges (e.g. on mutual fund)B
                add(new LabelField("Underlying asset charges (e.g. on mutual fund)B:"));
                add(assestChargeBValue);
                add(new LabelField("% of net premium charged by fund manager"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Renewal Commission
                add(new LabelField("Renewal Commission:"));
                add(renCommissionValue);
                add(new LabelField("% per annum of fund"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Investment Advisory Fee
                add(new LabelField("Investment Advisory Fee:"));
                add(AdFeeValue);
                add(new LabelField("% per annum of fund"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Establishment Charge
                add(new LabelField("Establishment Charge:"));
                add(estChargeValue);
                add(new LabelField("% per annum guaranteed for"));
                add(monthsEstChargeValue);
                add(new LabelField("months as percentage of"));
                add(premfunEstChargeChoice);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Policy Fee
                add(new LabelField("Policy Fee:"));
                add(policyFeeValue);
                add(new LabelField("per policy per annum taken quarterly in arrears and inflating"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Surrender penalty (value not year dependent)
                add(new LabelField("Surrender penalty (value not year dependent):"));
                add(surrPenValue);
                add(new LabelField("% applied if surrender occurs in first"));
                add(monthsSurrPenValue);
                add(new LabelField("months as percentage of"));
                add(premfunSurrPenChoice);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Surrender Penalty at end of year t                                
                add(new LabelField("Surrender Penalty at end of year t:"));
                add(surrPenEoyValue);
                add(new LabelField("% x (5 - t) of fund plus"));
                add(perOfPremiumSurrPenEoyValue);
                add(new LabelField("% x (5 - t) of premium"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Trailer fee to LIA (for sales margin check):                
                add(new LabelField("Trailer fee to LIA (for sales margin check):"));
                add(trailerFeeValue);
                add(new LabelField("%"));

                //HEADER & Seperators - Other Assumptions
                add(new LabelField(""));
                add(new SeparatorField());
                add(new SeparatorField());
                LabelField header6 = new LabelField("Other Assumptions -");                
                header6.setFont(fnt);
                add(header6);
                add(new SeparatorField());
                add(new SeparatorField());

                //Premium
                add(new LabelField("Premium:"));
                add(premiumValue);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Premium Currency                
                add(new LabelField("Premium Currency:"));
                add(currencyChoice);
                add(new LabelField(" --"));
                add(new LabelField(""));

                //Premium Frequency
                add(new LabelField("Premium Frequency:"));
                add(premFreqChoice);
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Premium Term (only for non-single premium)
                add(new LabelField("Premium Term (only for non-single premium):"));
                add(premTermValue);
                add(new LabelField("years"));
                add(new LabelField(" --"));
                add(new LabelField(""));
                
                //Partial Surrenders (only for single premium policies)
                add(new LabelField("Partial Surrenders (only for single premium policies):"));
                add(partialSurrValue);
                add(new LabelField("% per annum of premium taken"));
                add(takenAsPartialSurrChoice);
                add(new LabelField("in arrears"));
                add(new LabelField(""));

                
                add(new SeparatorField());
                add(new LabelField(""));
                add(clearButton);                
                
                FieldListener submitListener = new FieldListener();
                submitButton.setChangeListener(submitListener);
                
                add(submitButton);

                
         }


/*
-------------------------------------------
-------------------------------------------
END OF MAIN DATA ENTRY SCREEN
-------------------------------------------
-------------------------------------------
*/

/* -------------------------------------------------------------------------------------- */


private String getFieldData() {
        StringBuffer sb = new StringBuffer();
        
        /*
        -- EXAMPLE HERE --
        
        sb.append("dateTime=");
        sb.append(dateTimeField.toString() + "&");
        sb.append("category=");
        sb.append(category.getChoice(category.getSelectedIndex()) + "&");
        */
        
        
        sb.append("clientNameText=");
        sb.append(clientNameText.getText() + "&" );
        sb.append("ageValue=");
        sb.append(ageValue.getText() + "&" );
        sb.append("genderChoice=");
        sb.append(genderChoice.getChoice(genderChoice.getSelectedIndex()) + "&" );
        sb.append("prodNameText=");
        sb.append(prodNameText.getText() + "&" );
        sb.append("partnerNameChoice=");
        sb.append(partnerNameChoice.getChoice(partnerNameChoice.getSelectedIndex()) + "&" );
        sb.append("partnerNameText=");
        sb.append(partnerNameText.getText() + "&" );
        sb.append("addressText=");
        sb.append(addressText.getText() + "&" );
        sb.append("telNumberText=");
        sb.append(telNumberText.getText() + "&" );
        sb.append("goldlistChoice=");
        sb.append(goldlistChoice.getChoice(goldlistChoice.getSelectedIndex()) + "&" );
        sb.append("initialCommValue=");
        sb.append(initialCommValue.getText() + "&" );
        sb.append("allocationRateValue=");
        sb.append(allocationRateValue.getText() + "&" );
        sb.append("bidOfferSpreadValue=");
        sb.append(bidOfferSpreadValue.getText() + "&" );
        sb.append("adminChargeValue=");
        sb.append(adminChargeValue.getText() + "&" );
        sb.append("monthsAdminChargeValue=");
        sb.append(monthsAdminChargeValue.getText() + "&" );
        sb.append("assestChargeAValue=");
        sb.append(assestChargeAValue.getText() + "&" );
        sb.append("assestChargeBValue=");
        sb.append(assestChargeBValue.getText() + "&" );
        sb.append("renCommissionValue=");
        sb.append(renCommissionValue.getText() + "&" );
        sb.append("AdFeeValue=");
        sb.append(AdFeeValue.getText() + "&" );
        sb.append("estChargeValue=");
        sb.append(estChargeValue.getText() + "&" );
        sb.append("monthsEstChargeValue=");
        sb.append(monthsEstChargeValue.getText() + "&" );
        sb.append("premfunEstChargeChoice=");
        sb.append(premfunEstChargeChoice.getChoice(premfunEstChargeChoice.getSelectedIndex()) + "&" );
        sb.append("policyFeeValue=");
        sb.append(policyFeeValue.getText() + "&" );
        sb.append("surrPenValue=");
        sb.append(surrPenValue.getText() + "&" );
        sb.append("monthsSurrPenValue=");
        sb.append(monthsSurrPenValue.getText() + "&" );
        sb.append("premfunSurrPenChoice=");
        sb.append(premfunSurrPenChoice.getChoice(premfunSurrPenChoice.getSelectedIndex()) + "&" );
        sb.append("surrPenEoyValue=");
        sb.append(surrPenEoyValue.getText() + "&" );
        sb.append("perOfPremiumSurrPenEoyValue=");
        sb.append(perOfPremiumSurrPenEoyValue.getText() + "&" );
        sb.append("trailerFeeValue=");
        sb.append(trailerFeeValue.getText() + "&" );
        sb.append("premiumValue=");
        sb.append(premiumValue.getText() + "&" );
        sb.append("currencyChoice=");
        sb.append(currencyChoice.getChoice(currencyChoice.getSelectedIndex()) + "&" );
        sb.append("premFreqChoice=");
        sb.append(premFreqChoice.getChoice(premFreqChoice.getSelectedIndex()) + "&" );
        sb.append("premTermValue=");
        sb.append(premTermValue.getText() + "&" );
        sb.append("partialSurrValue=");
        sb.append(partialSurrValue.getText() + "&" );
        sb.append("takenAsPartialSurrChoice=");
        sb.append(takenAsPartialSurrChoice.getChoice(takenAsPartialSurrChoice.getSelectedIndex()));

        return sb.toString();
    }

    class FieldListener implements FieldChangeListener {
        public void fieldChanged(Field field, int context) {
            StringBuffer sb = new StringBuffer("Sending...");
            connThread
                    .post(
                            //Had to space this out like this as the forum thought it
                            //was a link and wouldnt let me post it...?
                            "http : // localhost : 8080 / servlet / ReceiveData ",
                            getFieldData());
            while (connThread.sending) {
                try {
                    Status.show( sb.append(".").toString() );
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            if (connThread.sendResult) {
                Status.show("Transmission Successful");
            } else {
                Status.show("Transmission Failed");
            }

        }
    }


//override onClose() to display a dialog box when the application is closed
public boolean onClose()
        {
                Dialog.alert("Goodbye!");
                System.exit(0);
                return true;
                }



private MenuItem _closeItem = new MenuItem("Close", 200000, 10) {
                public void run()
                {
                        onClose();
                }
        };


        //override makeMenu to add the new menu items
        protected void makeMenu( Menu menu, int instance )
        {
                menu.add(_closeItem);
        }

}
Offline  
Old 07-23-2008, 02:03 PM   #2 (permalink)
Thumbs Must Hurt
 
nyte3k's Avatar
 
Join Date: May 2008
Model: 8320
PIN: N/A
Carrier: Tmobile
Posts: 62
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmm, it appears you declare connThread in the LombardScreen, but you never assign it within your constructor.

so you have:
private ConnectionThread connThread;

and in your construction you need something like...
this.connThread = connThread;

where the latter "connThread" is the passed-in parameter in the constructor.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.