Example usage for android.widget LinearLayout addView

List of usage examples for android.widget LinearLayout addView

Introduction

In this page you can find the example usage for android.widget LinearLayout addView.

Prototype

public void addView(View child) 

Source Link

Document

Adds a child view.

Usage

From source file:com.microsoft.windowsazure.mobileservices.authentication.LoginManager.java

/**
 * Creates the UI for the interactive authentication process
 *
 * @param startUrl The initial URL for the authentication process
 * @param endUrl   The final URL for the authentication process
 * @param context  The context used to create the authentication dialog
 * @param callback Callback to invoke when the authentication process finishes
 *//*from  ww w  . ja va  2 s  .c o  m*/
private void showLoginUIInternal(final String startUrl, final String endUrl, final Context context,
        LoginUIOperationCallback callback) {
    if (startUrl == null || startUrl == "") {
        throw new IllegalArgumentException("startUrl can not be null or empty");
    }

    if (endUrl == null || endUrl == "") {
        throw new IllegalArgumentException("endUrl can not be null or empty");
    }

    if (context == null) {
        throw new IllegalArgumentException("context can not be null");
    }

    final LoginUIOperationCallback externalCallback = callback;
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    // Create the Web View to show the login page
    final WebView wv = new WebView(context);
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            if (externalCallback != null) {
                externalCallback.onCompleted(null, new MobileServiceException("User Canceled"));
            }
        }
    });

    wv.getSettings().setJavaScriptEnabled(true);

    DisplayMetrics displaymetrics = new DisplayMetrics();
    ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
    int webViewHeight = displaymetrics.heightPixels - 100;

    wv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, webViewHeight));

    wv.requestFocus(View.FOCUS_DOWN);
    wv.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View view, MotionEvent event) {
            int action = event.getAction();
            if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_UP) {
                if (!view.hasFocus()) {
                    view.requestFocus();
                }
            }

            return false;
        }
    });

    // Create a LinearLayout and add the WebView to the Layout
    LinearLayout layout = new LinearLayout(context);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(wv);

    // Add a dummy EditText to the layout as a workaround for a bug
    // that prevents showing the keyboard for the WebView on some devices
    EditText dummyEditText = new EditText(context);
    dummyEditText.setVisibility(View.GONE);
    layout.addView(dummyEditText);

    // Add the layout to the dialog
    builder.setView(layout);

    final AlertDialog dialog = builder.create();

    wv.setWebViewClient(new WebViewClient() {

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            // If the URL of the started page matches with the final URL
            // format, the login process finished

            if (isFinalUrl(url)) {
                if (externalCallback != null) {
                    externalCallback.onCompleted(url, null);
                }

                dialog.dismiss();
            }

            super.onPageStarted(view, url, favicon);
        }

        // Checks if the given URL matches with the final URL's format
        private boolean isFinalUrl(String url) {
            if (url == null) {
                return false;
            }

            return url.startsWith(endUrl);
        }

        // Checks if the given URL matches with the start URL's format
        private boolean isStartUrl(String url) {
            if (url == null) {
                return false;
            }

            return url.startsWith(startUrl);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            if (isStartUrl(url)) {
                if (externalCallback != null) {
                    externalCallback.onCompleted(null, new MobileServiceException(
                            "Logging in with the selected authentication provider is not enabled"));
                }

                dialog.dismiss();
            }
        }
    });

    wv.loadUrl(startUrl);
    dialog.show();
}

From source file:com.nextgis.mobile.map.RemoteTMSLayer.java

protected static void showPropertiesDialog(final MapBase map, final boolean bCreate, String layerName,
        String layerUrl, int type, final RemoteTMSLayer layer) {
    final LinearLayout linearLayout = new LinearLayout(map.getContext());
    final EditText input = new EditText(map.getContext());
    input.setText(layerName);/*  w  w w .j a v  a  2s .  c om*/

    final EditText url = new EditText(map.getContext());
    url.setText(layerUrl);

    final TextView stLayerName = new TextView(map.getContext());
    stLayerName.setText(map.getContext().getString(R.string.layer_name) + ":");

    final TextView stLayerUrl = new TextView(map.getContext());
    stLayerUrl.setText(map.getContext().getString(R.string.layer_url) + ":");

    final TextView stLayerType = new TextView(map.getContext());
    stLayerType.setText(map.getContext().getString(R.string.layer_type) + ":");

    final ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(map.getContext(),
            android.R.layout.simple_spinner_item);
    final Spinner spinner = new Spinner(map.getContext());
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    adapter.add(map.getContext().getString(R.string.tmstype_osm));
    adapter.add(map.getContext().getString(R.string.tmstype_normal));
    adapter.add(map.getContext().getString(R.string.tmstype_ngw));

    if (type == TMSTYPE_OSM) {
        spinner.setSelection(0);
    } else {
        spinner.setSelection(1);
    }

    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.addView(stLayerName);
    linearLayout.addView(input);
    linearLayout.addView(stLayerUrl);
    linearLayout.addView(url);
    linearLayout.addView(stLayerType);
    linearLayout.addView(spinner);

    new AlertDialog.Builder(map.getContext())
            .setTitle(bCreate ? R.string.input_layer_properties : R.string.change_layer_properties)
            //                                    .setMessage(message)
            .setView(linearLayout).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    int tmsType = 0;
                    switch (spinner.getSelectedItemPosition()) {
                    case 0:
                    case 1:
                        tmsType = TMSTYPE_OSM;
                        break;
                    case 2:
                    case 3:
                        tmsType = TMSTYPE_NORMAL;
                        break;
                    }

                    if (bCreate) {
                        create(map, input.getText().toString(), url.getText().toString(), tmsType);
                    } else {
                        layer.setName(input.getText().toString());
                        layer.setTMSType(tmsType);
                        map.onLayerChanged(layer);
                    }
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    // Do nothing.
                    Toast.makeText(map.getContext(), R.string.error_cancel_by_user, Toast.LENGTH_SHORT).show();
                }
            }).show();
}

From source file:com.java2s.intents4.IntentsDemo4Activity.java

void addRow(final LinearLayout layout, String label, String hintStr, boolean addRadioGroup) {
    LinearLayout.LayoutParams rowLayoutParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams editTextLayoutParams = new LinearLayout.LayoutParams(400,
            LinearLayout.LayoutParams.WRAP_CONTENT, 1);
    if (addRadioGroup) {
        editTextLayoutParams = new LinearLayout.LayoutParams(400, LinearLayout.LayoutParams.WRAP_CONTENT, 1);
    }//from  w ww . j  a  v a 2  s .c o  m
    LinearLayout.LayoutParams buttonLayoutParams = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 0);

    LinearLayout row = new LinearLayout(this);
    row.setOrientation(LinearLayout.HORIZONTAL);
    row.setGravity(Gravity.CENTER_VERTICAL);

    TextView textView = new TextView(this);
    textView.setText(label);
    row.addView(textView);
    EditText editText = new EditText(this);
    editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
    editText.setHint(hintStr);
    editText.setLayoutParams(editTextLayoutParams);
    if (!isFirstTime) {
        editText.requestFocus();
    }
    row.addView(editText);

    if (addRadioGroup) {
        LinearLayout groupLayout = new LinearLayout(this);
        groupLayout.setOrientation(LinearLayout.VERTICAL);
        groupLayout.setGravity(Gravity.CENTER_HORIZONTAL);

        RadioGroup group = new RadioGroup(this);
        group.setLayoutParams(new RadioGroup.LayoutParams(RadioGroup.LayoutParams.WRAP_CONTENT,
                RadioGroup.LayoutParams.WRAP_CONTENT));

        final Button patternButton = new Button(this);
        patternButton.setText(pathPatterns[0]);
        patternButton.setTextSize(8);
        patternButton.setLayoutParams(buttonLayoutParams);
        patternButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                String patternButtonText = patternButton.getText().toString().trim();
                if (patternButtonText.equals(pathPatterns[0])) {
                    patternButton.setText(pathPatterns[1]);
                } else if (patternButtonText.equals(pathPatterns[1])) {
                    patternButton.setText(pathPatterns[2]);
                } else if (patternButtonText.equals(pathPatterns[2])) {
                    patternButton.setText(pathPatterns[0]);
                }
            }
        });
        groupLayout.addView(patternButton);
        row.addView(groupLayout);
    }
    Button button = new Button(this);
    button.setTextSize(10);
    button.setTypeface(null, Typeface.BOLD);
    button.setText("X");
    button.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
    button.setLayoutParams(buttonLayoutParams);
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            layout.removeView((LinearLayout) view.getParent());
        }
    });
    row.addView(button);

    row.setLayoutParams(rowLayoutParams);
    layout.addView(row);
}

From source file:fr.cph.chicago.adapter.SearchAdapter.java

@Override
public final View getView(final int position, View convertView, final ViewGroup parent) {

    LayoutInflater vi = (LayoutInflater) ChicagoTracker.getAppContext()
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    convertView = vi.inflate(R.layout.list_search, null);

    TextView rounteName = (TextView) convertView.findViewById(R.id.station_name);

    if (position < mTrains.size()) {
        final Station station = (Station) getItem(position);
        Set<TrainLine> lines = station.getLines();

        rounteName.setText(station.getName());

        LinearLayout stationColorView = (LinearLayout) convertView.findViewById(R.id.station_color);

        int indice = 0;
        for (TrainLine tl : lines) {
            TextView textView = new TextView(mContext);
            textView.setBackgroundColor(tl.getColor());
            textView.setText(" ");
            textView.setTextSize(mContext.getResources().getDimension(R.dimen.activity_list_station_colors));
            stationColorView.addView(textView);
            if (indice != lines.size()) {
                textView = new TextView(mContext);
                textView.setText("");
                textView.setPadding(0, 0,
                        (int) mContext.getResources().getDimension(R.dimen.activity_list_station_colors_space),
                        0);//from  w w w  . j  a v a  2 s. c  om
                textView.setTextSize(
                        mContext.getResources().getDimension(R.dimen.activity_list_station_colors));
                stationColorView.addView(textView);
            }
            indice++;
        }
        convertView.setOnClickListener(
                new FavoritesTrainOnClickListener(mActivity, mContainer, station.getId(), lines));
    } else if (position < mTrains.size() + mBuses.size()) {
        final BusRoute busRoute = (BusRoute) getItem(position);

        TextView type = (TextView) convertView.findViewById(R.id.train_bus_type);
        type.setText("B");

        rounteName.setText(busRoute.getId() + " " + busRoute.getName());

        final TextView loadingTextView = (TextView) convertView.findViewById(R.id.loading_text_view);
        convertView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                loadingTextView.setVisibility(LinearLayout.VISIBLE);
                mActivity.startRefreshAnimation();
                new DirectionAsyncTask().execute(busRoute, loadingTextView);
            }
        });
    } else {
        final BikeStation bikeStation = (BikeStation) getItem(position);

        TextView type = (TextView) convertView.findViewById(R.id.train_bus_type);
        type.setText("D");

        rounteName.setText(bikeStation.getName());

        convertView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(ChicagoTracker.getAppContext(), BikeStationActivity.class);
                Bundle extras = new Bundle();
                extras.putParcelable("station", bikeStation);
                intent.putExtras(extras);
                mActivity.startActivity(intent);
                mActivity.overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
            }
        });
    }

    return convertView;
}

From source file:co.ldln.android.ObjectReadFragment.java

@Override
public void onReadSchemaResult(Schema schema) {
    mSchema = schema;//from w w w.  j  av  a  2 s.co  m
    HashMap<String, String> keyValueMap = mSyncableObject.getKeyValueMap();
    for (SchemaField schemaField : mSchema.getFields(mActivity)) {
        String label = schemaField.getLabel();
        String value = keyValueMap.get(label);
        String type = schemaField.getType();

        // Create a linear layout to hold the field
        LinearLayout ll = new LinearLayout(mActivity);
        LayoutParams llParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        ll.setLayoutParams(llParams);
        ll.setOrientation(LinearLayout.HORIZONTAL);

        // TODO: different UI for different field types

        // Default to TextView
        TextView labelTv = new TextView(mActivity);
        LayoutParams labelTvParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        labelTv.setLayoutParams(labelTvParams);
        labelTv.setText(label);
        labelTv.setPadding(0, 0, 20, 0);
        labelTv.setTypeface(Typeface.DEFAULT_BOLD);
        ll.addView(labelTv);

        TextView valueTv = new TextView(mActivity);
        LayoutParams valueTvParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        valueTv.setLayoutParams(valueTvParams);
        valueTv.setText(value);
        ll.addView(valueTv);

        mFormHolder.addView(ll);
    }
}

From source file:com.manning.androidhacks.hack004.preference.AboutDialog.java

@Override
protected View onCreateDialogView() {
    LinearLayout layout = new LinearLayout(mContext);
    layout.setOrientation(LinearLayout.VERTICAL);
    TextView splashText = new TextView(mContext);
    String fmt = "Version %s<br />" + "<a href=\"http://manning.com/sessa\">MoreInfo</a>";
    try {//from   w  w  w. j  a  va 2  s .  co m
        String pkg = mContext.getPackageName();
        mVersionNumber = mContext.getPackageManager().getPackageInfo(pkg, 0).versionName;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }

    if (mVersionNumber != null) {
        String aboutMsg = String.format(fmt, mVersionNumber);
        splashText.setText(Html.fromHtml(aboutMsg));
        splashText.setMovementMethod(LinkMovementMethod.getInstance());
    }

    layout.addView(splashText);

    return layout;
}

From source file:com.cairoconfessions.MainActivity.java

public void report(View view) {

    final EditText edit = new EditText(this);
    final RadioGroup choices = new RadioGroup(this);
    edit.setText("I would like to report this confession");
    final String[] selectedItem = getResources().getStringArray(R.array.report_choices);

    for (int i = 0; i < selectedItem.length; i++) {
        RadioButton choice = new RadioButton(this);
        choice.setText(selectedItem[i]);
        choices.addView(choice);//ww  w .  ja v  a  2  s  .  c o m
    }
    choices.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // checkedId is the RadioButton selected
            edit.setText("I would like to report this confession as "
                    + ((RadioButton) group.findViewById(checkedId)).getText().toString());

        }
    });
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);
    ll.addView(choices);
    ll.addView(edit);
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Choose which categories:").setView(ll)
            .setPositiveButton(R.string.send, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // User clicked OK button
                    reportReceived();
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    // User clicked Cancel button
                }
            }).show();
}

From source file:com.eyekabob.EventInfo.java

protected void loadEvent(JSONObject response) {
    try {//from ww w . j ava 2  s  .c  o  m
        JSONObject jsonEvent = response.getJSONObject("event");

        artists = new ArrayList<String>();
        title = jsonEvent.getString("title");
        JSONObject jsonAllArtists = jsonEvent.getJSONObject("artists");
        headliner = jsonAllArtists.getString("headliner");
        Object artistObj = jsonAllArtists.get("artist");
        JSONArray jsonOpeners = new JSONArray();
        if (artistObj instanceof JSONArray) {
            jsonOpeners = (JSONArray) artistObj;
        }
        for (int i = 0; i < jsonOpeners.length(); i++) {
            String artistName = jsonOpeners.getString(i);
            if (!headliner.equals(artistName)) {
                artists.add(artistName);
            }
        }

        JSONObject jsonVenue = jsonEvent.getJSONObject("venue");
        venue = jsonVenue.optString("name");
        venueCity = jsonVenue.optString("city");
        venueStreet = jsonVenue.optString("street");
        venueUrl = jsonVenue.optString("url");
        startDate = EyekabobHelper.LastFM.toReadableDate(jsonEvent.getString("startDate"));
        JSONObject image = EyekabobHelper.LastFM.getLargestJSONImage(jsonEvent.getJSONArray("image"));
        imageUrl = image.getString("#text");
    } catch (JSONException e) {
        Log.e(getClass().getName(), "", e);
    }

    try {
        new EventImageTask().execute(new URL(imageUrl));
    } catch (MalformedURLException e) {
        Log.e(getClass().getName(), "Bad image URL [" + imageUrl + "]", e);
    }

    TextView titleView = (TextView) findViewById(R.id.infoMainHeader);
    titleView.setText(title);

    TextView headlinerView = (TextView) findViewById(R.id.infoSubHeaderOne);
    // TODO: I18N
    headlinerView.setText("Headlining: " + headliner);

    TextView dateTimeView = (TextView) findViewById(R.id.infoSubHeaderTwo);
    dateTimeView.setText(startDate);

    if (!startDate.equals("")) {
        Button tixButton = (Button) findViewById(R.id.infoTicketsButton);
        tixButton.setVisibility(View.VISIBLE);
    }

    LinearLayout artistsView = (LinearLayout) findViewById(R.id.infoFutureEventsContent);
    TextView alsoPerformingView = (TextView) findViewById(R.id.infoFutureEventsHeader);
    if (!artists.isEmpty()) {
        // TODO: I18N
        alsoPerformingView.setText("Also Performing:");
        for (String artist : artists) {
            TextView row = new TextView(this);
            row.setTextColor(Color.WHITE);
            row.setText(artist);
            row.setPadding(20, 0, 0, 20); // Left and bottom padding
            artistsView.addView(row);
        }
    }

    String venueDesc = "";
    TextView venueView = (TextView) findViewById(R.id.infoEventVenue);
    // TODO: Padding instead of whitespace
    venueDesc += "         " + venue;
    if (!venueCity.equals("") && !venueStreet.equals("")) {
        // TODO: I18N
        venueDesc += "\n         Address: " + venueStreet + "\n" + venueCity;
    }
    // TODO: Padding instead of whitespace
    venueDesc += "\n         " + startDate;

    TextView venueTitleView = (TextView) findViewById(R.id.infoBioHeader);
    if (!venue.equals("") || !venueCity.equals("") || !venueStreet.equals("")) {
        // TODO: I18N
        venueTitleView.setText("Venue Details:");
        View vView = findViewById(R.id.infoVenueDetails);
        vView.setVisibility(View.VISIBLE);
    } else {
        // TODO: I18N
        venueTitleView.setText("No Venue Details Available");
    }

    venueView.setVisibility(View.VISIBLE);
    venueView.setText(venueDesc);

    TextView websiteView = (TextView) findViewById(R.id.infoVenueWebsite);
    if (!venueUrl.equals("")) {
        // TODO: I18N
        websiteView.setVisibility(View.VISIBLE);
        websiteView.setText(Html.fromHtml("<a href=\"" + venueUrl + "\">More Information</a>"));
        websiteView.setMovementMethod(LinkMovementMethod.getInstance());
    }
}

From source file:co.ldln.android.ObjectCreateFragment.java

@Override
public void onReadSchemaResult(final Schema schema) {
    mTextFields = new ArrayList<EditText>();

    // Create the form based on the schema fields
    List<SchemaField> fieldList = new ArrayList<SchemaField>();
    fieldList.addAll(schema.getFields(mActivity));
    Collections.sort(fieldList);/*w w  w .java2s.com*/
    for (SchemaField field : fieldList) {
        String type = field.getType();
        String label = field.getLabel();

        // Create a linear layout to hold the field
        LinearLayout ll = new LinearLayout(mActivity);
        LayoutParams llParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        ll.setLayoutParams(llParams);
        ll.setOrientation(LinearLayout.HORIZONTAL);

        // TODO: different UI for different field types

        // Default to EditText
        EditText et = new EditText(mActivity);
        LayoutParams etParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        et.setLayoutParams(etParams);
        et.setHint(label);
        if (type.equals("map_location"))
            et.setText(mMapLocation);
        ll.addView(et);
        mTextFields.add(et);

        mFormHolder.addView(ll);
    }

    // Add submit button
    Button b = new Button(mActivity);
    LayoutParams bParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    b.setText("Save");
    b.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                String kvPairs = "";
                JSONObject kvPairsJsonObject = new JSONObject();
                for (EditText et : mTextFields) {
                    String key = et.getHint().toString();
                    String value = et.getText().toString();
                    kvPairsJsonObject.put(key, value);
                }
                kvPairs = kvPairsJsonObject.toString();

                LDLN.saveSyncableObject(mActivity, ObjectCreateFragment.this, schema.getKey(), kvPairs);
            } catch (JSONException e) {
                e.printStackTrace();
                onSaveSyncableObjectResult(false);
            }
        }
    });
    mFormHolder.addView(b);

    Toast.makeText(mActivity,
            "This is a form that's dynamically generated from a syncable object schema. It will soon have handling for dynamic form elements (photo, latlon picker, etc).",
            Toast.LENGTH_LONG).show();
}

From source file:com.hbm.devices.scan.ui.android.DetailsFiller.java

private void addLabel(@NonNull LinearLayout layout, String label) {
    final AppCompatTextView labelView = new AppCompatTextView(activity);
    labelView.setPadding(activity.getResources().getDimensionPixelSize(R.dimen.device_info_padding_left),
            activity.getResources().getDimensionPixelSize(R.dimen.device_info_padding_top), 0, 0);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
        labelView.setTextAppearance(activity, R.style.DetailsLabelView);
    } else {//from ww w . j  a  v a  2s .  c om
        labelView.setTextAppearance(R.style.DetailsTextView);
    }

    labelView.setText(label);
    layout.addView(labelView);
}