Example usage for android.widget TableRow addView

List of usage examples for android.widget TableRow addView

Introduction

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

Prototype

public void addView(View child, int index) 

Source Link

Document

Adds a child view.

Usage

From source file:Main.java

private static TableRow generateAfiTblRow(Context context, String first, String second) {
    TableRow tr = new TableRow(context);
    tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    LayoutParams childLp = new LayoutParams(0, LayoutParams.FILL_PARENT, 1);

    TextView amount = new TextView(context);
    amount.setText(first);/*  w  ww . ja va  2  s  . co  m*/
    amount.setGravity(Gravity.CENTER);
    tr.addView(amount, childLp);

    TextView score = new TextView(context);
    score.setText(second);
    score.setGravity(Gravity.CENTER);
    tr.addView(score, childLp);

    return tr;
}

From source file:com.svpino.longhorn.artifacts.StockTileProcessor.java

public static void create(Fragment fragment, TableLayout tableLayout, List<Stock> stocks,
        SparseArray<View> tiles, boolean restart) {

    if (restart) {
        tableLayout.removeAllViews();//from w w  w .j a va2  s .  c  om
        if (tiles != null) {
            tiles.clear();
        }
    }

    tableLayout.setStretchAllColumns(true);
    tableLayout.setShrinkAllColumns(true);

    int margin = Extensions.dpToPixels(fragment.getResources(), 3);
    int height = Extensions.dpToPixels(fragment.getResources(), 90);

    int index = createFixedHeaderRow(fragment, tableLayout, stocks, tiles, height, margin);

    int row = index == 3 ? 1 : 0;

    while (index < stocks.size()) {
        index = createStandardRow(fragment, tableLayout, stocks, tiles, height, margin, index, row);
        row++;
    }

    while (tableLayout.getChildCount() > row) {
        tableLayout.removeViewAt(tableLayout.getChildCount() - 1);
    }

    if (stocks.size() % 2 != 0) {
        TableRow tableRow = new TableRow(fragment.getActivity());

        View addNewStockTile = createTileForAddingNewStock(fragment);
        tableRow.addView(addNewStockTile, getSpannedLayoutParams(row, margin, height));

        tableLayout.addView(tableRow);
    } else {
        TableRow tableRow = (TableRow) tableLayout.getChildAt(tableLayout.getChildCount() - 1);
        LayoutParams layoutParams = (TableRow.LayoutParams) tableRow.getChildAt(0).getLayoutParams();
        layoutParams.bottomMargin = margin;
        layoutParams.height = height;
    }
}

From source file:com.svpino.longhorn.artifacts.StockTileProcessor.java

@TargetApi(11)
private static int createStandardRow(Fragment fragment, TableLayout tableLayout, List<Stock> stocks,
        SparseArray<View> tiles, int height, int margin, int index, int row) {

    Stock stock1 = stocks.get(index);/*w w  w . ja  v a  2 s  .co m*/
    Stock stock2 = (index + 1 < stocks.size()) ? stocks.get(index + 1) : null;

    if (shouldUpdateTableRow(tableLayout, row, stock1, stock2)) {
        TableRow tableRow = new TableRow(fragment.getActivity());

        boolean shouldSpanFirstTile = row % 2 != 0;
        boolean shouldSpanSecondTile = !shouldSpanFirstTile;

        if (stock2 != null) {
            View tile1 = createTile(fragment, stock1, index, shouldSpanFirstTile);
            tiles.put(index, tile1);
            tableRow.addView(tile1, shouldSpanFirstTile ? getPartialSpannedLayoutParams(row, height, margin)
                    : getNotSpannedLayoutParams(row, height, margin));

            View tile2 = createTile(fragment, stock2, index + 1, shouldSpanSecondTile);
            tiles.put(index + 1, tile2);
            tableRow.addView(tile2,
                    shouldSpanSecondTile ? getLastPartialSpannedLayoutParams(row, height, margin)
                            : getLastNotSpannedLayoutParams(row, height, margin));
        } else {
            View tile1 = createTile(fragment, stock1, index, shouldSpanFirstTile);
            tiles.put(index, tile1);
            tableRow.addView(tile1, shouldSpanFirstTile ? getPartialSpannedLayoutParams(row, height, margin)
                    : getNotSpannedLayoutParams(row, height, margin));

            View tile2 = createTileForAddingNewStock(fragment);
            tiles.put(index + 1, tile2);
            tableRow.addView(tile2,
                    shouldSpanSecondTile ? getLastPartialSpannedLayoutParams(row, height, margin)
                            : getLastNotSpannedLayoutParams(row, height, margin));
        }

        if (row < tableLayout.getChildCount()) {
            tableLayout.removeViewAt(row);
        }

        tableLayout.addView(tableRow, row);
    }

    return index + 2;
}

From source file:com.svpino.longhorn.artifacts.StockTileProcessor.java

private static int createFixedHeaderRow(Fragment fragment, TableLayout tableLayout, List<Stock> stocks,
        SparseArray<View> tiles, int height, int margin) {

    View view = tableLayout.getChildAt(0);

    if (view == null || view.getTag() != "fixed-header") {
        TableRow indexesTableRow = new TableRow(fragment.getActivity());

        TableRow.LayoutParams indixesLayoutParams = new TableRow.LayoutParams();
        indixesLayoutParams.topMargin = margin;
        indixesLayoutParams.rightMargin = margin;
        indixesLayoutParams.bottomMargin = margin;
        indixesLayoutParams.height = height;

        TableRow.LayoutParams lastIndexLayoutParams = new TableRow.LayoutParams();
        lastIndexLayoutParams.topMargin = margin;
        lastIndexLayoutParams.bottomMargin = margin;
        lastIndexLayoutParams.height = height;

        View tile1 = createTile(fragment, stocks.get(0), 0, false);
        View tile2 = createTile(fragment, stocks.get(1), 1, false);
        View tile3 = createTile(fragment, stocks.get(2), 2, false);

        tiles.put(0, tile1);//  w w w.  j  av  a  2 s  .co  m
        tiles.put(1, tile2);
        tiles.put(2, tile3);

        indexesTableRow.addView(tile1, indixesLayoutParams);
        indexesTableRow.addView(tile2, indixesLayoutParams);
        indexesTableRow.addView(tile3, lastIndexLayoutParams);
        indexesTableRow.setTag("fixed-header");

        tableLayout.addView(indexesTableRow);
    }

    return 3;
}

From source file:com.woofer.activity.personHomeActivity.java

public void showTable() {
    TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,
            TableRow.LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.LEFT;
    layoutParams.leftMargin = 30;/*from ww w  .  ja va 2  s .  c o  m*/
    layoutParams.bottomMargin = 10;
    layoutParams.topMargin = 10;

    for (int i = 0; i < 30; i++) {

        TableRow tableRow = new TableRow(this);
        TextView textView7 = new TextView(this);
        textView7.setText("" + i);
        textView7.setTextSize(18);
        textView7.setTextColor(Color.rgb(0, 0, 0));

        textView7.setPadding(15, 0, 15, 0);
        tableRow.addView(textView7, layoutParams);
        tableRow.setBackgroundColor(Color.WHITE);

        final int n = i;
        tableRow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(personHomeActivity.this, "Click item " + n, Toast.LENGTH_SHORT).show();
            }
        });

        mMainLayout.addView(tableRow);

        TableRow tableRow1 = new TableRow(this);
        TextView textView1 = new TextView(this);
        textView1.setText("Test pull down scrollvsfadasdsadsasadsadsadsadsadasdsadasdasdsadsaddasdiew " + i);
        textView1.setTextSize(16);
        textView1.setPadding(15, 0, 15, 15);
        tableRow1.addView(textView1, layoutParams);
        tableRow1.setBackgroundColor(Color.WHITE);

        tableRow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(personHomeActivity.this, "Click item " + n, Toast.LENGTH_SHORT).show();
            }
        });
        mMainLayout.addView(tableRow1);

        //            TableRow tableRow2 = new TableRow(this);
        //            //tableRow2.addView(textView2, layoutParams);
        //            ImageView imageView = new ImageView(this);
        //            imageView.setImageResource(R.drawable.icon_reply_t);
        //            imageView.setScaleX((float) a);
        //            imageView.setScaleY((float) a);
        //            imageView.setPadding(0, 0, 0, 0);
        //
        //            ImageView imageView1 = new ImageView(this);
        //            imageView1.setImageResource(R.drawable.icon_thumb_t);
        //            imageView1.setScaleX((float) a);
        //            imageView1.setScaleY((float) a);
        //            imageView1.setPadding(0, 0, 0, 0);
        //
        //
        //            //tableRow2.addView(imageView);
        //            tableRow2.addView(imageView1);
        //            mMainLayout.addView(tableRow2);
        TableLayout mytable = (TableLayout) findViewById(R.id.degital_textTL);
        int numberOfRow = 1;
        int numberOfColumn = 12;
        int cellDimension = 24;
        int cellPadding = 200;
        for (int row = 0; row < numberOfRow; row++) {
            tableRow = new TableRow(this);
            //tableRow.setLayoutParams(new TableLayout.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.MATCH_PARENT));
            tableRow.setLayoutParams(new TableLayout.LayoutParams(
                    (cellDimension + 2 * cellPadding) * numberOfColumn, cellDimension + 2 * cellPadding));

            for (int column = 0; column < numberOfColumn; column++) {
                if (column % 3 == 0) {
                    TextView textView = new TextView(this);
                    textView.setTextSize(20);
                    textView.setText("   ");
                    tableRow.addView(textView);
                }
                if (column % 3 == 1) {
                    if (column == 1) {
                        ImageView imageView = new ImageView(this);
                        imageView.setScaleX((float) 0.5);
                        imageView.setScaleY((float) 0.5);
                        imageView.setImageResource(R.drawable.icon_eye_t);
                        tableRow.addView(imageView);
                    }
                    if (column == 4) {
                        ImageView imageView = new ImageView(this);
                        imageView.setScaleX((float) 0.5);
                        imageView.setScaleY((float) 0.5);
                        imageView.setImageResource(R.drawable.icon_thumb_t);
                        tableRow.addView(imageView);
                    }
                    if (column == 7) {
                        ImageView imageView = new ImageView(this);
                        imageView.setScaleX((float) 0.5);
                        imageView.setScaleY((float) 0.5);
                        imageView.setImageResource(R.drawable.icon_reply_t);
                        tableRow.addView(imageView);
                    }
                    if (column == 10) {
                        ImageView imageView = new ImageView(this);
                        imageView.setScaleX((float) 0.5);
                        imageView.setScaleY((float) 0.5);
                        imageView.setImageResource(R.drawable.icon_pencil_t);
                        tableRow.addView(imageView);
                    }
                }
                if (column % 3 == 2) {
                    if (column == 2) {
                        TextView textView = new TextView(this);
                        textView.setText("8");
                        tableRow.addView(textView);
                    }
                    if (column == 5) {
                        TextView textView = new TextView(this);
                        textView.setText("8");
                        tableRow.addView(textView);
                    }
                    if (column == 8) {
                        TextView textView = new TextView(this);
                        textView.setText("8");
                        tableRow.addView(textView);
                    }
                    if (column == 11) {
                        TextView textView = new TextView(this);
                        textView.setText("8");
                        tableRow.addView(textView);
                    }
                }

            }
            mytable.addView(tableRow, new TableLayout.LayoutParams(
                    (cellDimension + 2 * cellPadding) * numberOfColumn, cellDimension + 2 * cellPadding));
            //mytable.addView(tableRow,new TableLayout.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.MATCH_PARENT));
        }

    }
}

From source file:com.windnow.StationTextActivity.java

@SuppressLint("RtlHardcoded")
private void printTableRow(String line) {
    TableLayout tl = (TableLayout) findViewById(R.id.tableLayout);

    String[] words = line.split("&/");
    TableRow tr = new TableRow(this);
    TableRow.LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);/*from  ww  w .  ja va  2s. com*/
    params.gravity = Gravity.FILL_HORIZONTAL;
    tr.setLayoutParams(params);

    TableRow.LayoutParams tvParams = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
            TableRow.LayoutParams.WRAP_CONTENT);
    tvParams.setMargins(0, 0, 6, 0);

    for (int i = words.length - 1; i >= 0; i--) {
        TextView txv = new TextView(this);
        txv.setLayoutParams(tvParams);
        txv.setText(words[i]);
        txv.setGravity(i == 0 ? Gravity.LEFT : Gravity.LEFT);
        tr.addView(txv, 0);
    }
    tl.addView(tr);
}

From source file:com.wifiafterconnect.WifiAuthenticatorActivity.java

private void addField(HtmlInput field) {
    Log.d(Constants.TAG, "adding [" + field.getName() + "], type = [" + field.getType() + "]");

    TextView labelView = new TextView(this);
    labelView.setText(field.getName());//from  w w  w .j  a  v  a2 s.c om
    int textSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, (float) 8,
            getResources().getDisplayMetrics());
    labelView.setTextSize(textSize);

    EditText editView = new EditText(this);
    editView.setInputType(field.getAndroidInputType());
    editView.setText(field.getValue());
    editView.setTag(field.getName());
    editView.setFocusable(true);

    edits.add(editView);

    editView.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onAuthenticateClick(v);
            }
            return false;
        }
    });

    TableRow row = new TableRow(this);
    fieldsTable.addView(row, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,
            TableLayout.LayoutParams.WRAP_CONTENT));

    TableRow.LayoutParams labelLayout = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
            TableRow.LayoutParams.WRAP_CONTENT);
    int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) 5,
            getResources().getDisplayMetrics());
    labelLayout.setMargins(margin, margin, margin, margin);
    row.addView(labelView, labelLayout);
    TableRow.LayoutParams editLayout = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,
            TableRow.LayoutParams.WRAP_CONTENT);
    row.addView(editView, editLayout);

}

From source file:com.example.hllut.app.Deprecated.MainActivity.java

/**
 * fill the "liters of petrol" textView, as well as drawing the petrol barrels
 *///from   ww w . ja v  a2s . c  o m
private void drawPetrol() {
    //TODO use the bundle
    float litersOfPetrol = (TOTAL_CO2 / CO2_PER_LITRE_PETROL);

    TextView tv = (TextView) findViewById(R.id.litersTextView);
    tv.setText("Burning " + String.format("%.2f", litersOfPetrol) + " liters of petrol");

    TableLayout layout = (TableLayout) findViewById(R.id.petrolContainer);

    TableRow newRow = new TableRow(this);
    LinearLayout linLay = new LinearLayout(this);

    linLay.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT, 1f));

    newRow.setLayoutParams(
            new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
    newRow.setPadding(10, 10, 10, 10);

    for (int i = 1; i < (int) litersOfPetrol + 1; i++) { //
        // TODO: To many images fuck up formatting
        // Create images
        ImageView im = new ImageView(this);
        im.setImageResource(R.drawable.oil_barrel);
        im.setLayoutParams(
                new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));

        //barrells per row = 7
        if (i % 7 == 0) {
            // if you have gone 7 laps
            // print what you have
            linLay.addView(im);
            newRow.addView(linLay,
                    new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));

            layout.addView(newRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,
                    TableLayout.LayoutParams.WRAP_CONTENT));

            newRow = new TableRow(this);
            linLay = new LinearLayout(this);

            linLay.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT, 1f));

            newRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
                    TableRow.LayoutParams.WRAP_CONTENT));
            newRow.setPadding(10, 10, 10, 10);
        } else {
            linLay.addView(im);
        }

    }

    newRow.addView(linLay, new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));

    layout.addView(newRow, new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,
            TableLayout.LayoutParams.WRAP_CONTENT));
}

From source file:com.example.hllut.app.Deprecated.MainActivity.java

/**
 * Fills "amount of planets" textView as well as drawing the planets
 *//*from   ww w. j  a  v a 2  s .c  o m*/
private void drawPlanets() {
    //TODO use the bundle
    int numberOfPlanets = (int) (TOTAL_CO2 / MAX_CO2_PER_PERSON);
    TextView need = (TextView) findViewById(R.id.planetsTextView);
    need.setText("We would need " + numberOfPlanets + " planets");

    TableLayout layout = (TableLayout) findViewById(R.id.planetContainer);

    TableRow tbr = new TableRow(this);

    LinearLayout linearLayout = new LinearLayout(this);

    linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT, 1f)); //TODO

    tbr.setLayoutParams(
            new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT));
    tbr.setPadding(10, 10, 10, 10);

    for (int i = 1; i < numberOfPlanets + 1; i++) {
        // TODO: Too many planets fuck up formatting
        // Create images
        ImageView im = new ImageView(this);
        im.setImageResource(R.drawable.earth);
        im.setLayoutParams(
                new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));
        im.setPadding(10, 10, 10, 10);

        //planets per row = 5
        if (i % 5 == 0) {
            // if you have gone 5 laps
            // print what you have
            linearLayout.addView(im);
            tbr.addView(linearLayout,
                    new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1f));

            layout.addView(tbr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,
                    TableLayout.LayoutParams.MATCH_PARENT));

            tbr = new TableRow(this);
            linearLayout = new LinearLayout(this);

            linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.MATCH_PARENT, 1f));

            tbr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,
                    TableRow.LayoutParams.MATCH_PARENT));
            tbr.setPadding(10, 10, 10, 10);
        } else {
            linearLayout.addView(im);
        }

    }

    tbr.addView(linearLayout,
            new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1f)); //

    layout.addView(tbr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,
            TableLayout.LayoutParams.MATCH_PARENT));
}

From source file:com.mifos.utils.DataTableUIBuilder.java

public LinearLayout getDataTableLayout(final DataTable dataTable, JsonArray jsonElements,
        LinearLayout parentLayout, final Context context, final int entityId,
        DataTableActionListener mListener) {
    dataTableActionListener = mListener;

    /**//from w ww .  j  av a  2  s .co m
     * Create a Iterator with Json Elements to Iterate over the DataTable
     * Response.
     */
    Iterator<JsonElement> jsonElementIterator = jsonElements.iterator();
    /*
     * Each Row of the Data Table is Treated as a Table Here.
     * Creating the First Table for First Row
     */
    tableIndex = 0;
    while (jsonElementIterator.hasNext()) {
        TableLayout tableLayout = new TableLayout(context);
        tableLayout.setPadding(10, 10, 10, 10);

        final JsonElement jsonElement = jsonElementIterator.next();
        /*
        * Each Entry in a Data Table is Displayed in the
        * form of a table where each row contains one Key-Value Pair
        * i.e a Column Name - Column Value from the DataTable
        */
        int rowIndex = 0;
        while (rowIndex < dataTable.getColumnHeaderData().size()) {
            TableRow tableRow = new TableRow(context);
            tableRow.setLayoutParams(new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
            tableRow.setPadding(10, 10, 10, 10);
            if (rowIndex % 2 == 0) {
                tableRow.setBackgroundColor(Color.LTGRAY);
            } else {
                tableRow.setBackgroundColor(Color.WHITE);
            }

            TextView key = new TextView(context);
            key.setText(dataTable.getColumnHeaderData().get(rowIndex).getColumnName());
            key.setGravity(Gravity.LEFT);
            TextView value = new TextView(context);
            value.setGravity(Gravity.RIGHT);
            if (jsonElement.getAsJsonObject().get(dataTable.getColumnHeaderData().get(rowIndex).getColumnName())
                    .toString().contains("\"")) {
                value.setText(jsonElement.getAsJsonObject()
                        .get(dataTable.getColumnHeaderData().get(rowIndex).getColumnName()).toString()
                        .replace("\"", ""));
            } else {
                value.setText(jsonElement.getAsJsonObject()
                        .get(dataTable.getColumnHeaderData().get(rowIndex).getColumnName()).toString());
            }

            tableRow.addView(key, new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
            tableRow.addView(value, new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT, 1f));
            TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT);
            layoutParams.setMargins(12, 16, 12, 16);
            tableLayout.addView(tableRow, layoutParams);

            rowIndex++;
        }

        tableLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Toast.makeText(context, "Update Row " + tableIndex, Toast.LENGTH_SHORT).show();
            }
        });

        tableLayout.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {

                Toast.makeText(context, "Deleting Row " + tableIndex, Toast.LENGTH_SHORT).show();

                BaseApiManager baseApiManager = new BaseApiManager();
                DataManager dataManager = new DataManager(baseApiManager);
                Observable<GenericResponse> call = dataManager
                        .removeDataTableEntry(dataTable.getRegisteredTableName(), entityId,
                                Integer.parseInt(jsonElement.getAsJsonObject()
                                        .get(dataTable.getColumnHeaderData().get(0).getColumnName())
                                        .toString()));
                Subscription subscription = call.subscribeOn(Schedulers.io())
                        .observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<GenericResponse>() {
                            @Override
                            public void onCompleted() {

                            }

                            @Override
                            public void onError(Throwable e) {

                            }

                            @Override
                            public void onNext(GenericResponse genericResponse) {
                                Toast.makeText(context, "Deleted Row " + tableIndex, Toast.LENGTH_SHORT).show();
                                dataTableActionListener.onRowDeleted();
                            }
                        });

                return true;
            }
        });

        View v = new View(context);
        v.setBackgroundColor(ContextCompat.getColor(context, R.color.black));
        parentLayout.addView(tableLayout);
        parentLayout.addView(v, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 5));
        Log.i("TABLE INDEX", "" + tableIndex);
        tableIndex++;
    }
    return parentLayout;
}