Example usage for android.widget TableLayout getChildAt

List of usage examples for android.widget TableLayout getChildAt

Introduction

In this page you can find the example usage for android.widget TableLayout getChildAt.

Prototype

public View getChildAt(int index) 

Source Link

Document

Returns the view at the specified position in the group.

Usage

From source file:com.retroteam.studio.retrostudio.MeasureEditor.java

/**
 * Assign a note visually and in the project.
 * @param view//w w  w . ja  v a 2  s .c o m
 */
private void paintNote(View view) {
    com.getbase.floatingactionbutton.FloatingActionButton ptool = (com.getbase.floatingactionbutton.FloatingActionButton) findViewById(
            R.id.pencilTool);
    ImageView iview = (ImageView) view;
    Drawable notestatus = iview.getDrawable();
    if (pencil) {
        if (notestatus.getConstantState().equals(ContextCompat
                .getDrawable(getApplicationContext(), R.drawable.note_filled).getConstantState())) {

            //blank all other notes in the column
            TableRow parent = (TableRow) iview.getParent();
            TableLayout layoutparent = (TableLayout) parent.getParent();
            int notedrawlen = layoutparent.getChildCount();
            for (int x = 0; x < notedrawlen; x++) {
                TableRow noterow = (TableRow) layoutparent.getChildAt(x);
                for (int i = 0; i < noterow.getChildCount(); i++) {
                    ImageView note = (ImageView) noterow.getChildAt(i);
                    if (note.getTag(R.id.TAG_COLUMN) == iview.getTag(R.id.TAG_COLUMN)) {
                        note.setImageDrawable(
                                ContextCompat.getDrawable(getApplicationContext(), R.drawable.measure_outline));
                        for (int n = 0; n < filledNotes.size(); n++) {
                            int[] comp = filledNotes.get(n);
                            if (comp[0] == (int) note.getTag(R.id.TAG_ROW)
                                    && comp[1] == (int) note.getTag(R.id.TAG_COLUMN)) {
                                filledNotes.remove(n);
                            }
                        }
                    }
                }
            }
            //set the drawable
            iview.setImageDrawable(
                    ContextCompat.getDrawable(getApplicationContext(), R.drawable.measure_outline));
            filledNotes.remove(
                    new int[] { (int) iview.getTag(R.id.TAG_ROW), (int) iview.getTag(R.id.TAG_COLUMN) });

            // set the other notes to rests
            List<Integer> guiSNAPRange = (List<Integer>) iview.getTag(R.id.TAG_GUISNAPRANGE);
            for (int z = guiSNAPRange.get(0); z <= guiSNAPRange.get(guiSNAPRange.size() - 1); z++) {
                theproject.track(trackNum).measure(measureNum).replace(z, new Note(Note.REST, noteSUB));
            }
        } else {
            //blank all other notes in the column
            TableRow parent = (TableRow) iview.getParent();
            TableLayout layoutparent = (TableLayout) parent.getParent();
            int notedrawlen = layoutparent.getChildCount();
            for (int x = 0; x < notedrawlen; x++) {
                TableRow noterow = (TableRow) layoutparent.getChildAt(x);
                for (int i = 0; i < noterow.getChildCount(); i++) {
                    ImageView note = (ImageView) noterow.getChildAt(i);
                    if (note.getTag(R.id.TAG_COLUMN) == iview.getTag(R.id.TAG_COLUMN)) {
                        note.setImageDrawable(
                                ContextCompat.getDrawable(getApplicationContext(), R.drawable.measure_outline));
                        for (int n = 0; n < filledNotes.size(); n++) {
                            int[] comp = filledNotes.get(n);
                            if (comp[0] == (int) note.getTag(R.id.TAG_ROW)
                                    && comp[1] == (int) note.getTag(R.id.TAG_COLUMN)) {
                                filledNotes.remove(n);
                            }
                        }
                    }
                }
            }
            //set the drawable
            iview.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.note_filled));
            filledNotes
                    .add(new int[] { (int) iview.getTag(R.id.TAG_ROW), (int) iview.getTag(R.id.TAG_COLUMN) });

            //set the note in the data structure
            double notetype = stringToNoteDouble((String) iview.getTag(R.id.TAG_NOTE));
            List<Integer> guiSNAPRange = (List<Integer>) iview.getTag(R.id.TAG_GUISNAPRANGE);
            for (int z = guiSNAPRange.get(0); z <= guiSNAPRange.get(guiSNAPRange.size() - 1); z++) {
                theproject.track(trackNum).measure(measureNum).replace(z, new Note(notetype, noteSUB));
            }
        }
    }
}

From source file:com.cybrosys.currency.CurrencyMain.java

public void onStart() {
    super.onStart();
    getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
    linlaHeaderProgress = (LinearLayout) getView().findViewById(R.id.linlaHeaderProgress);
    imgvHead = (ImageView) getView().findViewById(R.id.imageHead);
    txtvHead = (TextView) getView().findViewById(R.id.textHead);
    lstvMainlistView = (ListView) getView().findViewById(R.id.listview);
    etxtText = (EditText) getView().findViewById(R.id.editText1);
    slide = (SlidingDrawer) getView().findViewById(R.id.SlidingDrawer);
    TableLayout tablePad = (TableLayout) getView().findViewById(R.id.tablone);
    int inPadCount = tablePad.getChildCount();
    for (int i = 0; i < inPadCount; i++) {
        View v = tablePad.getChildAt(i);
        if (v instanceof TableRow) {
            TableRow row = (TableRow) v;
            int rowCount = row.getChildCount();

            for (int r = 0; r < rowCount; r++) {
                View v2 = row.getChildAt(r);

                if (v2 instanceof Button) {
                    Button b = (Button) v2;
                    b.setOnClickListener(buttonpad);
                } else if (v2 instanceof TextView) {
                    TextView txtv = (TextView) v2;
                    txtv.setOnClickListener(null);
                }//  w ww.  ja  va  2s .co  m
            }
        }
    }
    isFlag2 = true;
    Settings = getActivity().getSharedPreferences(strPREFERNAME, 0);
    for (int inI = 0; inI <= 5; inI++) {
        if (Settings.getString("val" + inI, "").equals("") && Settings.getString("CrnCode" + inI, "").equals("")
                && Settings.getString("flag" + inI, "").equals("")) {
            isFlag2 = false;
        }

    }
    if (isFlag2 == true) {
        Sharepreferences();
    } else {
        CustomListView();
        if (isConnection() == true) {
        } else {
            isFlag2 = true;
            isFlag = true;
            Toast.makeText(getActivity(), "No Internet Conection", Toast.LENGTH_LONG).show();
        }
    }
    SharedPreferences prefs = PalmCalcActivity.ctx.getSharedPreferences("UpdateTime", 0);
    lastUpdateTime = prefs.getLong("lastUpdateTime", 0);
    if ((lastUpdateTime) <= System.currentTimeMillis()) {
        lastUpdateTime = System.currentTimeMillis();
        SharedPreferences.Editor editors = prefs.edit();
        editors.putLong("lastUpdateTime", lastUpdateTime);
        editors.commit();
        if (isConnection() == true) {
            new BackProsess().execute(getActivity());
        }
    }
    etxtText.addTextChangedListener(textwach);
    aList = new ArrayList<HashMap<String, String>>();
    for (int InI = 0; InI < 5; InI++) {
        hm = new HashMap<String, String>();
        hm.put("flag", Integer.toString(fltFlags[InI]));
        if (InI != 5) {
            hm.put("cur", strCrnCode[InI].substring(0, 3));
        } else {
            hm.put("cur", strCrnCode[InI]);
        }
        aList.add(hm);
    }
    txtvHead.setText(strCrnCode[5]);
    imgvHead.setImageResource(fltFlags[5]);
    adapter = new ListAdapter1(getActivity(), aList);
    lstvMainlistView.setAdapter(adapter);
    lstvMainlistView.setOnItemClickListener(ListsingleClick);
    lstvMainlistView.setOnItemLongClickListener(ListLongClick);
    Decimalpoint();
    View vwMain = (View) getActivity().findViewById(R.id.idCurrencyMain);
    vwMain.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            slide.close();
            return true;
        }
    });
    etxtText.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!slide.isOpened()) {
                slide.open();
            }
        }
    });
    if (!Settings.getString("Input", "").equals("")) {
        calculation(Double.parseDouble(Settings.getString("Input", "")));
        etxtText.setText("");
        etxtText.setText(Settings.getString("Input", ""));
    } else {
        etxtText.setText(Settings.getString("Input", "1"));
    }
}

From source file:com.retroteam.studio.retrostudio.MeasureEditor.java

/**
 * Draw the grid.//from w  ww  .  j  ava 2 s  .c  o m
 */
private void drawGrid() {
    //draw the grid based on project info
    thisMeasure = theproject.track(trackNum).measure(measureNum);
    TableLayout notedraw = (TableLayout) findViewById(R.id.notedraw);
    int notedrawlen = notedraw.getChildCount();

    //get note scale
    final float dscale = getApplicationContext().getResources().getDisplayMetrics().density;
    int notewidth = (int) (144 * dscale + 0.5f);
    int noteheight = (int) (75 * dscale + 0.5f);

    for (int x = 0; x < notedrawlen; x++) {
        TableRow noterow = (TableRow) notedraw.getChildAt(x);
        List<List<Integer>> rangelist = numNotesFromGuiSnap();
        for (int i = 0; i < rangelist.size(); i++) {
            ImageView note = new ImageView(getApplicationContext());
            note.setLayoutParams(new TableRow.LayoutParams(notewidth, noteheight));

            note.setTag(R.id.TAG_ROW, x);
            note.setTag(R.id.TAG_COLUMN, i);
            note.setTag(R.id.TAG_NOTE, notesdisplay[x]);

            note.setTag(R.id.TAG_GUISNAPRANGE, rangelist.get(i));

            note.setImageResource(R.drawable.measure_outline);
            if (filledNotesFromIntent.size() > 0) {
                for (int z = 0; z < filledNotesFromIntent.size(); z++) {
                    if ((filledNotesFromIntent.get(z)[0] == x) && (filledNotesFromIntent.get(z)[1] == i)) {
                        note.setImageResource(R.drawable.note_filled);
                    }
                }
            }

            note.setBackgroundColor(getResources().getColor(R.color.note_rest));

            note.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    paintNote(v);

                }
            });

            noterow.addView(note);
        }
    }
}

From source file:universe.constellation.orion.viewer.OrionViewerActivity.java

public void updateCrops() {
    controller.getMargins(cropBorders);//w  w  w  .  j  av  a2s . c  o  m
    TableLayout cropTable = (TableLayout) findMyViewById(R.id.crop_borders);
    for (int i = 0; i < cropTable.getChildCount(); i++) {
        TableRow row = (TableRow) cropTable.getChildAt(i);
        TextView valueView = (TextView) row.findViewById(R.id.crop_value);
        valueView.setText(cropBorders[i] + "%");
    }

    TableLayout cropTable2 = (TableLayout) findMyViewById(R.id.crop_borders_even);
    int index = 4;
    for (int i = 0; i < cropTable2.getChildCount(); i++) {
        if (cropTable2.getChildAt(i) instanceof TableRow) {
            TableRow row = (TableRow) cropTable2.getChildAt(i);
            TextView valueView = (TextView) row.findViewById(R.id.crop_value);
            valueView.setText(cropBorders[index] + "%");
            index++;
        }
    }
    ((CheckBox) findMyViewById(R.id.crop_even_flag)).setChecked(controller.isEvenCropEnabled());
}

From source file:com.mobicage.rogerthat.plugins.messaging.ServiceMessageDetailActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    mDisplayWidth = UIUtils.getDisplayWidth(this);

    if (!mSomebodyAnswered) {
        TableLayout tableLayout = (TableLayout) findViewById(R.id.buttons);
        for (int i = 0; i < tableLayout.getChildCount(); i++) {
            TableRow row = (TableRow) tableLayout.getChildAt(i);
            Button button = (Button) row.getChildAt(0);
            button.setWidth(mDisplayWidth - UIUtils.convertDipToPixels(this, 12));
        }// w w w. ja  v  a 2s . com
    }
}

From source file:reportsas.com.formulapp.Formulario.java

public int ObtenerRespuesta(LinearLayout contenedor, Pregunta Pregunta,
        ArrayList<PreguntaRespuesta> respuestaList) {
    PreguntaRespuesta result = new PreguntaRespuesta();
    int numRespuesta = 0;
    result.setIdPregunta(Pregunta.getIdPregunta());
    EditText resp;/*w ww  .j  a  v  a  2  s.co  m*/
    TextView selectio;
    switch (Pregunta.getTipoPregunta()) {
    case 1:
        resp = (EditText) contenedor.findViewById(R.id.edtTexto);
        result.setItem(1);
        result.setRespuesta(resp.getText().toString());
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 2:
        resp = (EditText) contenedor.findViewById(R.id.mtxtEdit);
        result.setItem(1);
        result.setRespuesta(resp.getText().toString());
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 3:
        selectio = (TextView) contenedor.findViewById(R.id.respuestaGruop);
        result.setItem(1);
        result.setRespuesta(selectio.getText().toString());
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 4:

        String resp_opcio = "";
        for (int j = 0; j < contenedor.getChildCount(); j++) {
            View child = contenedor.getChildAt(j);
            if (child instanceof CheckBox) {
                CheckBox hijo = (CheckBox) child;
                if (hijo.isChecked()) {
                    if (resp_opcio.length() == 0) {
                        if (Pregunta.isOpcionEditble(hijo.getText().toString())) {
                            EditText otrosR = (EditText) contenedor.findViewById(R.id.edtTexto);
                            resp_opcio = otrosR.getText().toString();
                        } else {
                            resp_opcio = hijo.getText().toString();
                        }
                    } else {
                        if (Pregunta.isOpcionEditble(hijo.getText().toString())) {
                            EditText otrosR = (EditText) contenedor.findViewById(R.id.edtTexto);
                            resp_opcio += " , " + otrosR.getText().toString() + " ";
                        } else {
                            resp_opcio = resp_opcio + " , " + hijo.getText() + " ";
                        }

                    }
                }
            }

        }
        result.setItem(1);
        result.setRespuesta(resp_opcio);
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 5:
        selectio = (TextView) contenedor.findViewById(R.id.seleEscala);
        result.setItem(1);
        result.setRespuesta(selectio.getText().toString());
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 6:
        Spinner lista = (Spinner) contenedor.findViewById(R.id.opcionesListado);
        result.setItem(1);
        result.setRespuesta(lista.getSelectedItem().toString() + "");
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 7:
        TableLayout tabla = (TableLayout) contenedor.findViewById(R.id.tablaOpciones);
        for (int i = 0; i < tabla.getChildCount(); i++) {
            TableRow registro = (TableRow) tabla.getChildAt(i);
            TextView etiq = (TextView) registro.findViewById(R.id.textoRow);
            RadioGroup selector = (RadioGroup) registro.findViewById(R.id.valoresRow);
            PreguntaRespuesta itemA = new PreguntaRespuesta();
            itemA.setIdPregunta(Pregunta.getIdPregunta());
            itemA.setItem(i + 1);
            itemA.setRespuesta(etiq.getText().toString());
            if (selector.getCheckedRadioButtonId() > 0) {
                RadioButton rb = (RadioButton) selector.findViewById(selector.getCheckedRadioButtonId());
                itemA.setOpcion(rb.getText() + "");
            }

            respuestaList.add(itemA);
            numRespuesta++;
        }

        break;
    case 8:
        DatePicker dp = (DatePicker) contenedor.findViewById(R.id.Fecha_resutl);
        result.setItem(1);
        result.setRespuesta(dp.getYear() + "-" + dp.getMonth() + "-" + dp.getDayOfMonth());
        respuestaList.add(result);
        numRespuesta = 1;
        break;
    case 9:
        TimePicker tp = (TimePicker) contenedor.findViewById(R.id.hora_result);
        result.setItem(1);
        result.setRespuesta(tp.getCurrentHour() + ":" + tp.getCurrentMinute());
        respuestaList.add(result);
        numRespuesta = 1;
        break;

    default:
        result.setItem(1);
        result.setRespuesta("Proceso");
        break;

    }

    return numRespuesta;

}

From source file:universe.constellation.orion.viewer.OrionViewerActivity.java

public void initCropScreen() {
    TableLayout cropTable = (TableLayout) findMyViewById(R.id.crop_borders);

    getSubscriptionManager().addDocListeners(new DocumentViewAdapter() {
        @Override//from  w  w  w.ja  v a 2  s.  c  o m
        public void documentOpened(Controller controller) {
            updateCrops();
        }
    });

    for (int i = 0; i < cropTable.getChildCount(); i++) {
        TableRow row = (TableRow) cropTable.getChildAt(i);
        row.findViewById(R.id.crop_plus);

        TextView valueView = (TextView) row.findViewById(R.id.crop_value);
        ImageButton plus = (ImageButton) row.findViewById(R.id.crop_plus);
        ImageButton minus = (ImageButton) row.findViewById(R.id.crop_minus);
        linkCropButtonsAndText(minus, plus, valueView, i);
    }

    //even cropping
    int index = 4;
    final TableLayout cropTable2 = (TableLayout) findMyViewById(R.id.crop_borders_even);
    for (int i = 0; i < cropTable2.getChildCount(); i++) {
        View child = cropTable2.getChildAt(i);
        if (child instanceof TableRow) {
            TableRow row = (TableRow) child;
            row.findViewById(R.id.crop_plus);
            TextView valueView = (TextView) row.findViewById(R.id.crop_value);
            ImageButton plus = (ImageButton) row.findViewById(R.id.crop_plus);
            ImageButton minus = (ImageButton) row.findViewById(R.id.crop_minus);
            linkCropButtonsAndText(minus, plus, valueView, index);
            index++;
            for (int j = 0; j < row.getChildCount(); j++) {
                View v = row.getChildAt(j);
                v.setEnabled(false);
            }
        }
    }

    final ImageButton switchEven = (ImageButton) findMyViewById(R.id.crop_even_button);
    if (switchEven != null) {
        final ViewAnimator cropAnim = (ViewAnimator) findMyViewById(R.id.crop_animator);
        switchEven.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                cropAnim.setDisplayedChild((cropAnim.getDisplayedChild() + 1) % 2);
                switchEven.setImageResource(
                        cropAnim.getDisplayedChild() == 0 ? R.drawable.next : R.drawable.prev);
            }
        });
    }

    final CheckBox checkBox = (CheckBox) findMyViewById(R.id.crop_even_flag);
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            for (int i = 0; i < cropTable2.getChildCount(); i++) {
                View child = cropTable2.getChildAt(i);
                if (child instanceof TableRow) {
                    TableRow row = (TableRow) child;
                    for (int j = 0; j < row.getChildCount(); j++) {
                        View rowChild = row.getChildAt(j);
                        rowChild.setEnabled(isChecked);
                    }
                }
            }
        }
    });

    //        if (Device.Info.NOOK2) {
    //            TextView tv = (TextView) findMyViewById(R.id.navigation_title);
    //            int color = tv.getTextColors().getDefaultColor();
    //            checkBox.setTextColor(color);
    //        }

    ImageButton preview = (ImageButton) findMyViewById(R.id.crop_preview);
    preview.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            onApplyAction();
            controller.changeMargins(cropBorders[0], cropBorders[2], cropBorders[1], cropBorders[3],
                    checkBox.isChecked(), cropBorders[4], cropBorders[5]);
        }
    });

    ImageButton close = (ImageButton) findMyViewById(R.id.crop_close);
    close.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            //main menu
            onAnimatorCancel();
            //reset if canceled
            updateCrops();
        }
    });
}

From source file:com.samknows.measurement.activity.SamKnowsAggregateStatViewerActivity.java

private void clearGrid(int grid) {
    TableLayout table = (TableLayout) findViewById(grid);
    int count = table.getChildCount();
    for (int i = 0; i < count; i++) {
        View child = table.getChildAt(i);
        ((ViewGroup) child).removeAllViews();
    }//  w  w  w.j  ava 2  s. c  om
}

From source file:de.grobox.liberario.TripsActivity.java

private void addTrips(final TableLayout main, List<Trip> trip_list, boolean append) {
    if (trip_list != null) {
        // reverse order of trips if they should be prepended
        if (!append) {
            ArrayList<Trip> tempResults = new ArrayList<Trip>(trip_list);
            Collections.reverse(tempResults);
            trip_list = tempResults;//from w w w. j  a  v a 2  s.com
        }

        for (final Trip trip : trip_list) {
            final LinearLayout trip_layout = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.trip,
                    null);
            TableRow row = (TableRow) trip_layout.findViewById(R.id.tripTableRow);

            // Locations
            TextView fromView = (TextView) row.findViewById(R.id.fromView);
            fromView.setText(trip.from.uniqueShortName());
            TextView toView = ((TextView) row.findViewById(R.id.toView));
            toView.setText(trip.to.uniqueShortName());

            // Departure Time and Delay
            TextView departureTimeView = (TextView) row.findViewById(R.id.departureTimeView);
            TextView departureDelayView = (TextView) row.findViewById(R.id.departureDelayView);
            if (trip.getFirstPublicLeg() != null) {
                LiberarioUtils.setDepartureTimes(this, departureTimeView, departureDelayView,
                        trip.getFirstPublicLeg().departureStop);
            } else {
                departureTimeView.setText(DateUtils.getTime(this, trip.getFirstDepartureTime()));
            }

            // Arrival Time and Delay
            TextView arrivalTimeView = (TextView) row.findViewById(R.id.arrivalTimeView);
            TextView arrivalDelayView = (TextView) row.findViewById(R.id.arrivalDelayView);
            if (trip.getLastPublicLeg() != null) {
                LiberarioUtils.setArrivalTimes(this, arrivalTimeView, arrivalDelayView,
                        trip.getLastPublicLeg().arrivalStop);
            } else {
                arrivalTimeView.setText(DateUtils.getTime(this, trip.getLastArrivalTime()));
            }

            // Duration
            TextView durationView = (TextView) trip_layout.findViewById(R.id.durationView);
            durationView
                    .setText(DateUtils.getDuration(trip.getFirstDepartureTime(), trip.getLastArrivalTime()));

            // Transports
            FlowLayout lineLayout = (FlowLayout) trip_layout.findViewById(R.id.lineLayout);

            // for each leg
            for (final Leg leg : trip.legs) {
                if (leg instanceof Trip.Public) {
                    LiberarioUtils.addLineBox(this, lineLayout, ((Public) leg).line);
                } else if (leg instanceof Trip.Individual) {
                    LiberarioUtils.addWalkingBox(this, lineLayout);
                }
            }

            // remember trip in view for onClick event
            trip_layout.setTag(trip);

            // make trip details fold out and in on click
            trip_layout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    View v = main.getChildAt(main.indexOfChild(view) + 1);

                    if (v != null) {
                        if (v.getVisibility() == View.GONE) {
                            v.setVisibility(View.VISIBLE);
                        } else if (v.getVisibility() == View.VISIBLE) {
                            v.setVisibility(View.GONE);
                        }
                    }
                }

            });
            trip_layout.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View view) {
                    selectTrip(view, trip_layout);
                    return true;
                }
            });

            // show more button for trip details
            final ImageView showMoreView = (ImageView) trip_layout.findViewById(R.id.showMoreView);
            showMoreView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    selectTrip(view, trip_layout);
                }
            });

            // Create container for trip details fragment
            FrameLayout fragmentContainer = new FrameLayout(this);
            fragmentContainer.setId(mContainerId);
            fragmentContainer.setVisibility(View.GONE);

            // Create a new Fragment to be placed in the activity layout
            TripDetailFragment tripDetailFragment = new TripDetailFragment();

            // In case this activity was started with special instructions from an
            // Intent, pass the Intent's extras to the fragment as arguments
            Bundle bundle = new Bundle();
            bundle.putSerializable("de.schildbach.pte.dto.Trip", trip);
            bundle.putSerializable("de.schildbach.pte.dto.Trip.from", from);
            bundle.putSerializable("de.schildbach.pte.dto.Trip.to", to);
            tripDetailFragment.setArguments(bundle);

            // Add the fragment to the 'fragment_container' FrameLayout
            getSupportFragmentManager().beginTransaction().add(mContainerId, tripDetailFragment).commit();

            mContainerId++;

            if (append) {
                trip_layout.addView(LiberarioUtils.getDivider(this));
                main.addView(trip_layout);
                main.addView(fragmentContainer);
            } else {
                trip_layout.addView(LiberarioUtils.getDivider(this), 0);
                main.addView(trip_layout, 0);
                main.addView(fragmentContainer, 1);
            }
        } // end foreach trip

    } else {
        // TODO offer option to query again for trips
    }
}