Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7666699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:54:00+00:00 2026-05-31T14:54:00+00:00

I am calling a popupscreen where I have objectchoicefield where I select a data

  • 0

I am calling a popupscreen where I have objectchoicefield where I select a data from dropdown and set the value in static variable. I need to read this value in the constructor of the mainscreen from where popupscreen was called.

How to do this ?I want the same screen to be reloaded with the data that I selected now.

Initially when I launch the app I see the Ascreen with some data ,once I click on an image I call a popup screen ,where I select some data ,now I want to reload AScreen with the selected value,once popupscreen is closed.

Ascreen

Public AScreen(){
    String timezone_static = MyPopup.ocfDATA;
}
if (field == bitmapField1) {

    UiApplication.getUiApplication().pushScreen(new MyPopup(screen));

}

public class MyPopup extends PopupScreen {
    ObjectChoiceField ocf;
    NativeScreen deligate = null;
    public static String ocfDATA;

    public MyPopup(final NativeScreen deligate) {

        super(new VerticalFieldManager(), Field.FOCUSABLE);
        this.deligate = deligate;
        // this listener 'listens' for any event (see at the bottom)
        FieldListener listener = new FieldListener();

        TimeZone[] zone = TimeZoneUtilities.getAvailableTimeZones();
        ocf = new ObjectChoiceField("Set Timezone", zone);
        ocf.setChangeListener(listener);
        add(ocf);
    }

    class FieldListener implements FieldChangeListener {
        public void fieldChanged(Field f, int context) {

            if (f == ocf) {

                Object ob = ocf.getChoice(ocf.getSelectedIndex());
                String str = ob.toString();
                ocfDATA = str;
                deligate.valueChanged(str);
                Dialog.alert(str);
                close();
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:54:02+00:00Added an answer on May 31, 2026 at 2:54 pm

    i am explaining some of flow how to navigate from one screen another screen with values.
    this is simple way in your main screen

    protected void onExposed() {
            String timezone_static = MyPopup.ocfDATA;
        }
    

    otherwise you want to know more to navigate from one place to another is just understand following code

    package mypackage;
    
    import java.util.TimeZone;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.ObjectChoiceField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.PopupScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.util.TimeZoneUtilities;
    
    public final class MyScreen extends MainScreen implements FieldChangeListener
    {
        private ButtonField btn;
        private LabelField zone_name;
        public MyScreen()
        { 
            //may be you have lots of parameters in constructers those all are in live state only design values you can delete
    
            CreateGui("Default Zone");// add all your design in this function 
        }
        public void CreateGui(String selcetd_time_zone)
        {
            setTitle(selcetd_time_zone);
            zone_name=new LabelField(selcetd_time_zone, Field.FOCUSABLE);
            btn=new ButtonField("select timezone",Field.FOCUSABLE);
            btn.setChangeListener(this);
            add(btn);
            add(zone_name);
        }
        public void ReloadScreenAccordingToNewZone(String zone_name)
        {
            synchronized (UiApplication.getEventLock()) {
                deleteAll();//clean your GUI
                invalidate();
                CreateGui(zone_name);
            }
    
        }
        public void fieldChanged(Field field, int context) {
            if(field==btn)
            {
                 UiApplication.getUiApplication().pushScreen(new MyPopup(MyScreen.this));
            }
        }
    }
    class MyPopup extends PopupScreen implements FieldChangeListener{
        ObjectChoiceField ocf;
        MyScreen deligate = null;
        public MyPopup(MyScreen deligate) {
            super(new VerticalFieldManager(), Field.FOCUSABLE);
            this.deligate = deligate;
            TimeZone[] zone = TimeZoneUtilities.getAvailableTimeZones();
            ocf = new ObjectChoiceField("Set Timezone", zone);
            ocf.setChangeListener(this);
            add(ocf);
        }
        public void fieldChanged(Field field, int context) {
            if(field==ocf)
            {
                Object ob = ocf.getChoice(ocf.getSelectedIndex());
                deligate.ReloadScreenAccordingToNewZone(ob.toString());
                close();
            }
    
        }
    
    }
    

    My suggestion is that if you want to update more design from another class then just separate out the constructor and design

    like

    all your design write in one method suppose CreateGui(); call this method from constructer;
    if you want to reload update design just call CreateGui from onExposed() method

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Calling image = Image.open(data) image.thumbnail((36,36), Image.NEAREST) will maintain the aspect ratio. But I need
Calling this method: public static @Nonnull <TV, TG extends TV> Maybe<TV> something(final @Nonnull TG
Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
Calling Index view is giving me this very very annoying error . Can anybody
Calling a .net SOAP1.1 web service from android using ksoap2 lib I met a
While calling XslCompiledTransform.Transform() method I get this exception : The Writer is closed or
Calling the UDF like so: SELECT product_name, SUM(quantity) AS SumQty, SUM(face_value) AS SumFaceValue, SUM(net_cost)AS
Calling a function from the MasterPage in a Page is quite straigt forward but
Calling all MQ Gurus, I have a box under my desk which we use
Calling index.php?pConta=1&pDataInicial=01-01-2000&pDataFinal=31-12-2000 I get this notices: [08-Oct-2009 17:30:35] PHP Notice: Undefined index: pConta in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.