Components of the forms disappear II

21 views
Skip to first unread message

rdvg...@gmail.com

unread,
Sep 14, 2018, 12:57:40 PM9/14/18
to CodenameOne Discussions
Hi,

On August 27, I wrote version one of my question: " Components of the forms disappear". Today I checked the code and found nothing, I proceeded to change it to minimize its size but I still have the same problems. The truth is that it happens in at least 3 forms of my application and added to this I find that a form with the dialog component grows or changes its form without changes in programming. I must clarify that my application handles many records and I smell that it is due to a problem with memory.

I show you the ways mentioned and the code changed.

   private void formaTienda(final Form fmLiber) {
        final Form fmTienda = new Form(new BorderLayout());
        fmTienda.getToolbar().setBackCommand("", e -> fmLiber.showBack());
        fmTienda.getToolbar().getStyle().setAlignment(Label.LEFT);
        fmTienda.setTitle(idioma.getTiendas());

        TextField txNombreTienda = new TextField();
        txNombreTienda.setHint(idioma.getTienda());

        Container cnTiendas = new Container(BoxLayout.y());
        cnTiendas.setScrollableY(true);

        txNombreTienda.addDataChangeListener((int type, int index) -> {
            String t = txNombreTienda.getText();
            if (t.length() == 0) {
                return;
            }
            char[] p = t.toCharArray();
            if (p.length == 0) {
                return;
            } else {
                if (p[p.length - 1] != ' ') {
                    return;
                }
            }
            ArrayList l = new ArrayList();
            l = dT.leeArrayListDatos(t, TIENDA_LEE_NOMBRE);

            if (l == null || l.isEmpty()) {
                return;
            }
            if (l.size() < LIMITE_DATOS) {
                cnTiendas.removeAll();
                for (int i = 0; i < l.size(); i++) {
                    Tienda tDa = registroTienda((Map<String, String>) l.get(i));
                    Container cnItemTienda = creaItemTienda(fmTienda, tDa);
                    cnTiendas.add(cnItemTienda);
                }
            } else {
                Dialog.show(idioma.getInformacion(), idioma.getMensaje21(), idioma.getContinuar(), null);
            }
            cnTiendas.animateLayout(250);
        });

        Style s = UIManager.getInstance().getComponentStyle("Title");
        FontImage iInformacion = FontImage.createMaterial(FontImage.MATERIAL_INFO, s);
        fmTienda.getToolbar().addCommandToRightBar(new Command("", iInformacion) {
            @Override
            public void actionPerformed(ActionEvent evt) {
                formaInformacion(fmTienda, idioma.getTiendas(), idioma.getMensaje68() + idioma.getMensaje32());
            }
        });

        FloatingActionButton btNuevo = FloatingActionButton.createFAB(FontImage.MATERIAL_ADD);
        btNuevo.bindFabToContainer(fmTienda.getContentPane(), Component.RIGHT, Component.BOTTOM);
        btNuevo.addActionListener((e) -> {
            Tienda tDa = new Tienda();
            mantenimientoTienda(fmTienda, tDa, ADICIONAR);
        });

        fmTienda.add(BorderLayout.NORTH, txNombreTienda);
        fmTienda.add(BorderLayout.CENTER, cnTiendas);
        fmTienda.setTransitionOutAnimator(CommonTransitions.createSlide(
                CommonTransitions.SLIDE_VERTICAL, true, 500));
        fmTienda.show();
    }

Shai Almog

unread,
Sep 15, 2018, 12:48:54 AM9/15/18
to CodenameOne Discussions
Hi,
you would see a crash if a memory issue was involved. I suggest looking at the console for the device and seeing if something was printed when this happened.
Use a process of elimination to try and determine the part of the code that's responsible for this issue.

rdvg...@gmail.com

unread,
Sep 18, 2018, 11:46:47 PM9/18/18
to CodenameOne Discussions
Hi,

I am a man older than 50 and I skipped java and object oriented programming to work on codename one.

I have doubts about the console you mention. Is the debug console that has my IDE (netbeans) or  what?

Shai Almog

unread,
Sep 19, 2018, 12:43:21 AM9/19/18
to CodenameOne Discussions
Hi,
the console of where this is happening. The console for the device if it happens there. For Android you can debug with a cable and for other devices there is this cn1lib https://www.codenameone.com/blog/native-logging-certificate-wizard.html
Reply all
Reply to author
Forward
0 new messages