List of usage examples for android.widget TableRow addView
public void addView(View child)
Adds a child view.
From source file:edu.pdx.its.portal.routelandia.ListStat.java
private void buildTable(int rows, int cols, ArrayList<TrafficStat> trafficStats, TableLayout tableLayout) { // outer for loop for (int i = -1; i < rows; i++) { TableRow row = new TableRow(this); row.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); if (i == -1) { for (int j = 0; j < cols; j++) { TextView tv = new TextView(this); tv.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); tv.setBackgroundResource(R.drawable.cell_shape); tv.setPadding(40, 40, 40, 40); tv.setTextColor(Color.BLACK); if (j == 0) { tv.setText("Time"); } else if (j == 1) { tv.setText("Speed"); } else if (j == 2) { tv.setText("Travel Time"); } else { tv.setText("Prediction Accuracy"); }//from w ww .ja v a2s . c om row.addView(tv); } } else { // inner for loop for (int j = 0; j < cols; j++) { TextView tv = new TextView(this); tv.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); tv.setBackgroundResource(R.drawable.cell_shape); tv.setPadding(40, 40, 40, 40); tv.setTextColor(Color.BLACK); if (j == 0) { if (trafficStats.get(i).getMinutes() == 0) { tv.setText(trafficStats.get(i).getHour() + ":" + trafficStats.get(i).getMinutes() + trafficStats.get(i).getMinutes()); } else { tv.setText(trafficStats.get(i).getHour() + ":" + trafficStats.get(i).getMinutes()); } } else if (j == 1) { tv.setText(trafficStats.get(i).getSpeed() + " MPH"); } else if (j == 2) { tv.setText(trafficStats.get(i).getTravelTime() + " Min"); } else { tv.setText(trafficStats.get(i).getAccuracy() + "%"); } row.addView(tv); } } tableLayout.addView(row); } }
From source file:org.mythdroid.activities.Guide.java
/** * Generate a TableRow from the provided Channel * @param ch Channel to generate a row for * @return populated TableRow representing the channel *///from ww w. j a v a 2s . co m @SuppressLint("DefaultLocale") private TableRow getRowFromChannel(Channel ch) { final TableRow row = new TableRow(this); row.setLayoutParams(rowLayout); TextView tv = new TextView(this); tv.setBackgroundColor(0xffe0e0f0); tv.setTextColor(0xff202020); tv.setPadding(4, 4, 4, 4); tv.setMaxLines(2); tv.setTag(ch.ID); tv.setText(ch.num + " " + ch.callSign); //$NON-NLS-1$ tv.setOnClickListener(chanClickListener); tv.setOnLongClickListener(chanLongClickListener); tv.setLayoutParams(chanLayout); row.addView(tv); LayoutParams layout = null; Program[] progs = ch.programs.toArray(new Program[ch.programs.size()]); int numprogs = progs.length; for (int i = 0; i < numprogs; i++) { if (progs[i].StartTime.equals(later)) continue; tv = new TextView(this); layout = new LayoutParams(this, null); layout.topMargin = layout.bottomMargin = layout.leftMargin = layout.rightMargin = 1; layout.height = rowHeight; String cat = catPat.matcher(progs[i].Category.toLowerCase()).replaceAll(""); //$NON-NLS-1$ try { tv.setBackgroundColor(Category.valueOf(cat).color()); } catch (IllegalArgumentException e) { tv.setBackgroundColor(Category.unknown.color()); } tv.setTextColor(0xfff0f0f0); tv.setPadding(4, 4, 4, 4); tv.setMaxLines(2); tv.setText(progs[i].Title); setStatusDrawable(tv, progs[i]); int width = setLayoutParams(layout, progs[i]) * colWidth; if (width < 1) continue; tv.setWidth(width); tv.setLayoutParams(layout); tv.setTag(progs[i]); tv.setOnClickListener(progClickListener); row.addView(tv); } return row; }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private void populateFraming(List<String> headers) { final Context context = getContext(); addView(constructRowSeparator(1));//w ww . ja va2 s . com headerOffset++; if (tableName.isPresent()) { addTitleRowWithSeparator(context, 1f, 1f); } if (orderResolver.isPresent() && !orderBy.isPresent()) { for (final String h : headers) { final Optional<OrderBy> possibleOrder = orderResolver.get().byColumnName(h, Order.DESC); if (possibleOrder.isPresent()) { orderBy = Optional.of(possibleOrder.get()); break; } } } final int curHdrOff = rowsPerSet > 1 ? headerOffset + 1 : headerOffset; headerOffset = addDataRow(headers, headerOffset, Optional.<Consumer<TextView>>of(new Consumer<TextView>() { @Override public void accept(TextView textView) { if (orderResolver.isPresent() && orderBy.isPresent() && textView.getText().toString() .equals(orderResolver.get().byField(orderBy.get().field).orElse(null))) { selectOrderByColumn(textView); } textView.setOnClickListener(rowOrderListener); } })); final int colArrLength = headerOffset - curHdrOff; final TableRow[] rArr = new TableRow[colArrLength]; for (int i = 0; i < colArrLength; i++) { rArr[i] = (TableRow) getChildAt(curHdrOff + i); } columnsRow = Optional.of(rArr); addView(constructRowSeparator(1)); final TableRow footerRow = constructRow(context, 1f); footer = new LinearLayout(context); final TableRow.LayoutParams fp = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, 0, 1f); fp.span = itemsPerInnerRow; footer.setLayoutParams(fp); footer.setBackgroundResource(R.drawable.cell_shape); footer.setGravity(Gravity.CENTER); footer.setOrientation(HORIZONTAL); footer.setVisibility(GONE); footerRow.addView(footer); addView(footerRow); addView(constructRowSeparator(1)); }
From source file:itesm.mx.golpedecalor.MonitoringActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_monitoring); alerta = false;/*from w w w . ja v a2 s .c o m*/ dbo = new DataBaseOperations(getApplicationContext()); groupId = getIntent().getLongExtra("id", 0); // Referencias a objetos de interfacae tablaTL = (TableLayout) findViewById(R.id.tablaTL); nombreTV = (TextView) findViewById(R.id.nombreTV); causaTV = (TextView) findViewById(R.id.causaTV); parametroTV = (TextView) findViewById(R.id.parametroTV); switcherVS = (ViewSwitcher) findViewById(R.id.switcherVS); mp = MediaPlayer.create(this, R.raw.alert); recomendacionesTV = (TextView) findViewById(R.id.recomendacionesTV); // Inicializacin rc = new ArrayList<TextView>(); temp = new ArrayList<TextView>(); rad = new ArrayList<TextView>(); try { dbo.open(); } catch (SQLException ex) { Log.e("", ex.toString()); } grupo = dbo.getGroup(groupId); grupo.setIntegrantes(dbo.getAllUsersFromGroup(grupo)); monitoreoHelper = new Monitoreo(grupo, this); for (Usuario u : grupo.getIntegrantes()) { TableRow tr = new TableRow(this); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.FILL_PARENT)); TextView tvAux = new TextView(this); tvAux.setText(u.getNombre() + " " + u.getApellidos()); tvAux.setLayoutParams(new TableRow.LayoutParams(400, TableRow.LayoutParams.WRAP_CONTENT)); TextView rcAux = new TextView(this); rcAux.setText("5"); rcAux.setLayoutParams(new TableRow.LayoutParams(200, TableRow.LayoutParams.WRAP_CONTENT)); TextView tempAux = new TextView(this); tempAux.setText("9"); tempAux.setLayoutParams(new TableRow.LayoutParams(200, TableRow.LayoutParams.WRAP_CONTENT)); TextView radAux = new TextView(this); radAux.setText("10"); radAux.setLayoutParams(new TableRow.LayoutParams(100, TableRow.LayoutParams.WRAP_CONTENT)); rc.add(rcAux); temp.add(tempAux); rad.add(radAux); tr.addView(tvAux); tr.addView(rcAux); tr.addView(tempAux); tr.addView(radAux); tr.setBackgroundResource(R.drawable.tabla); // Asigna recurso de drawable a la row nueva tablaTL.addView(tr); } monitoreoHelper.empezarMonitoreo(); notificationIntent = new Intent(getApplicationContext(), NotificationActivity.class); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); dialogClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: monitoreoHelper.terminarAlerta(); break; case DialogInterface.BUTTON_NEGATIVE: //No button clicked break; } } }; }
From source file:com.landenlabs.all_devtool.IconBaseFragment.java
/** * Show a 'LayerDrawable' information./* www .j a v a2 s . co m*/ * * @param imageView * @param row1 * @param row2 * @param iconD * @param layerIdx */ private void showLayerIcon(final ImageView imageView, TableRow row1, TableRow row2, Drawable iconD, int layerIdx) { if (iconD != null) { ImageView layerImageView = new ImageView(imageView.getContext()); layerImageView.setImageDrawable(iconD); layerImageView.setPadding(10, 10, 10, 10); layerImageView.setMinimumHeight(8); layerImageView.setMinimumWidth(8); layerImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { imageView.setImageDrawable(((ImageView) v).getDrawable()); } }); TextView stateTextView = new TextView(imageView.getContext()); stateTextView.setText(String.valueOf(layerIdx)); stateTextView.setTextSize(12); stateTextView.setGravity(Gravity.CENTER); row1.addView(stateTextView); row2.addView(layerImageView); } }
From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java
protected void showCellGsm(CellTowerGsm cell) { TableRow row = new TableRow(rilCells.getContext()); row.setWeightSum(29);//from ww w .j a v a 2 s .c o m TextView newType = new TextView(rilCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newMcc = new TextView(rilCells.getContext()); newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMcc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newMcc.setText(formatCellData(rilCells.getContext(), "%03d", cell.getMcc())); row.addView(newMcc); TextView newMnc = new TextView(rilCells.getContext()); newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMnc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newMnc.setText(formatCellData(rilCells.getContext(), "%02d", cell.getMnc())); row.addView(newMnc); TextView newLac = new TextView(rilCells.getContext()); newLac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newLac.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newLac.setText(formatCellData(rilCells.getContext(), null, cell.getLac())); row.addView(newLac); TextView newCid = new TextView(rilCells.getContext()); newCid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newCid.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); if ((mainActivity.prefCid) && (cell.getCid() != CellTower.UNKNOWN) && (cell.getCid() > 0x0ffff)) { int rtcid = cell.getCid() / 0x10000; int cid = cell.getCid() % 0x10000; newCid.setText(String.format("%d-%d", rtcid, cid)); } else newCid.setText(formatCellData(rilCells.getContext(), null, cell.getCid())); row.addView(newCid); TextView newPsc = new TextView(rilCells.getContext()); newPsc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newPsc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newPsc.setText(formatCellData(rilCells.getContext(), null, cell.getPsc())); row.addView(newPsc); TextView newDbm = new TextView(rilCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java
protected void showCellCdma(CellTowerCdma cell) { TableRow row = new TableRow(rilCdmaCells.getContext()); row.setWeightSum(26);/* ww w . j a va2s .c o m*/ TextView newType = new TextView(rilCdmaCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilCdmaCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilCdmaCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newSid = new TextView(rilCdmaCells.getContext()); newSid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 6)); newSid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newSid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getSid())); row.addView(newSid); TextView newNid = new TextView(rilCdmaCells.getContext()); newNid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newNid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newNid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getNid())); row.addView(newNid); TextView newBsid = new TextView(rilCdmaCells.getContext()); newBsid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newBsid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newBsid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getBsid())); row.addView(newBsid); TextView newDbm = new TextView(rilCdmaCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilCdmaCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilCdmaCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.RadioSectionFragment.java
protected void showCellLte(CellTowerLte cell) { TableRow row = new TableRow(rilLteCells.getContext()); row.setWeightSum(29);//from ww w. jav a 2s. c o m TextView newType = new TextView(rilLteCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilLteCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilLteCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newMcc = new TextView(rilLteCells.getContext()); newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMcc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newMcc.setText(formatCellData(rilLteCells.getContext(), "%03d", cell.getMcc())); row.addView(newMcc); TextView newMnc = new TextView(rilLteCells.getContext()); newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMnc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newMnc.setText(formatCellData(rilLteCells.getContext(), "%02d", cell.getMnc())); row.addView(newMnc); TextView newTac = new TextView(rilLteCells.getContext()); newTac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newTac.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newTac.setText(formatCellData(rilLteCells.getContext(), null, cell.getTac())); row.addView(newTac); TextView newCi = new TextView(rilLteCells.getContext()); newCi.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newCi.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); if ((mainActivity.prefCid) && (cell.getCi() != CellTower.UNKNOWN)) { int eNodeBId = cell.getCi() / 0x100; int sectorId = cell.getCi() % 0x100; newCi.setText(String.format("%d-%d", eNodeBId, sectorId)); } else newCi.setText(formatCellData(rilLteCells.getContext(), null, cell.getCi())); row.addView(newCi); TextView newPci = new TextView(rilLteCells.getContext()); newPci.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newPci.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newPci.setText(formatCellData(rilLteCells.getContext(), null, cell.getPci())); row.addView(newPci); TextView newDbm = new TextView(rilLteCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilLteCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilLteCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.acceleratedio.pac_n_zoom.SaveAnmActivity.java
private void dsply_tags() { TableLayout tbl_tag_lo = (TableLayout) findViewById(R.id.tl_tgs); int tag_mbr = 0; int tag_nmbr = fil_tags.length; String lst_str = ""; int row_mbr;//from w w w.j a va2 s.co m tbl_tag_lo.setAlpha(185); // - Find the search string srch_str = srch_str.trim(); boolean flg_srch_tags = !srch_str.equals(""); if (flg_srch_tags) { String[] srch_ary = srch_str.split("\\s* \\s*"); srch_str = srch_ary[srch_ary.length - 1].toLowerCase(); } // - Remove any current rows int row_nmbr = tbl_tag_lo.getChildCount(); if (row_nmbr > 0) tbl_tag_lo.removeAllViews(); for (row_mbr = 0; tag_mbr < tag_nmbr; row_mbr++) { TableRow tableRow = new TableRow(this); tableRow.setGravity(Gravity.CENTER); tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT, 1.0f)); int clm_mbr; for (clm_mbr = 0; clm_mbr < 3; clm_mbr++) { Button btnTag = new Button(this); while (tag_mbr < tag_nmbr && (fil_tags[tag_mbr].equals("") || fil_tags[tag_mbr].equalsIgnoreCase(lst_str) || flg_srch_tags && !fil_tags[tag_mbr].toLowerCase().startsWith(srch_str))) { lst_str = fil_tags[tag_mbr]; tag_mbr++; } if (tag_mbr >= tag_nmbr) break; lst_str = fil_tags[tag_mbr]; btnTag.setText(fil_tags[tag_mbr++]); btnTag.setOnClickListener(this); btnTag.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT)); tableRow.addView(btnTag); } if (clm_mbr > 0) tbl_tag_lo.addView(tableRow); } }
From source file:hongik.android.project.best.StoreActivity.java
public void drawPage() throws Exception { String query = "func=storereview" + "&license=" + license; DBConnector conn = new DBConnector(query); conn.start();//from www.j a v a2s .co m conn.join(); JSONObject jsonResult = conn.getResult(); boolean result = jsonResult.getBoolean("result"); if (!result) return; final JSONObject store = jsonResult.getJSONArray("store").getJSONObject(0); JSONArray menu = null; if (!jsonResult.isNull("menu")) menu = jsonResult.getJSONArray("menu"); JSONArray review = null; if (!jsonResult.isNull("review")) review = jsonResult.getJSONArray("review"); //Draw Store Information Lat = Double.parseDouble(store.getString("LAT")); Lng = Double.parseDouble(store.getString("LNG")); sname = store.getString("SNAME"); ((TextViewPlus) findViewById(R.id.store_storename)).setText(sname); ((TextViewPlus) findViewById(R.id.store_address)).setText(store.getString("ADDR")); ImageLoader imgLoader = new ImageLoader(store.getString("IMG")); imgLoader.start(); try { imgLoader.join(); Bitmap storeImg = imgLoader.getBitmap(); ((ImageView) findViewById(R.id.store_image)).setImageBitmap(storeImg); } catch (InterruptedException e) { Toast.makeText(this, "Can not bring " + license + "store's image", Toast.LENGTH_SHORT).show(); Log.e("StoreInfo", "Can not bring " + license + "store's image"); } //Draw Menu Table if (menu != null) { TableRow motive = (TableRow) menuTable.getChildAt(1); for (int i = 0; i < menu.length(); i++) { JSONObject json = menu.getJSONObject(i); TableRow tbRow = new TableRow(this); TextViewPlus[] tbCols = new TextViewPlus[3]; final String[] elements = new String[2]; elements[0] = json.getString("ITEM#"); elements[1] = json.getString("PRICE"); imgLoader = new ImageLoader(json.getString("IMG")); imgLoader.start(); imgLoader.join(); ImageView img = new ImageView(this); Bitmap bitmap = imgLoader.getBitmap(); img.setImageBitmap(bitmap); img.setLayoutParams(motive.getChildAt(0).getLayoutParams()); img.setScaleType(ImageView.ScaleType.FIT_XY); img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent storeIntent = new Intent(originActivity, MenuActivity.class); storeIntent.putExtra("LICENSE", license); storeIntent.putExtra("MENU", elements[0]); startActivity(storeIntent); } }); tbRow.addView(img); for (int j = 0; j < 2; j++) { tbCols[j] = new TextViewPlus(this); tbCols[j].setText(elements[j]); tbCols[j].setLayoutParams(motive.getChildAt(j + 1).getLayoutParams()); tbCols[j].setGravity(Gravity.CENTER); tbCols[j].setTypeface(Typeface.createFromAsset(tbCols[j].getContext().getAssets(), "InterparkGothicBold.ttf")); tbCols[j].setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent storeIntent = new Intent(originActivity, MenuActivity.class); storeIntent.putExtra("LICENSE", license); storeIntent.putExtra("MENU", elements[0]); startActivity(storeIntent); } }); Log.i("StoreMenu", "COL" + j + ":" + elements[j]); tbRow.addView(tbCols[j]); } menuTable.addView(tbRow); } } menuTable.removeViewAt(1); //Draw Review Table if (review != null) { TableRow motive = (TableRow) reviewTable.getChildAt(1); int rowCnt = 5; if (review.length() < 5) rowCnt = review.length(); for (int i = 0; i < rowCnt; i++) { JSONObject json = review.getJSONObject(i); final String[] elements = new String[4]; elements[0] = Double.parseDouble(json.getString("GRADE")) + ""; elements[1] = json.getString("NOTE"); elements[2] = json.getString("CID#"); elements[3] = json.getString("DAY"); TableRow tbRow = new TableRow(this); TextViewPlus[] tbCols = new TextViewPlus[4]; if (elements[1].length() > 14) elements[1] = elements[1].substring(0, 14) + "..."; for (int j = 0; j < 4; j++) { tbCols[j] = new TextViewPlus(this); tbCols[j].setText(elements[j]); tbCols[j].setLayoutParams(motive.getChildAt(j).getLayoutParams()); tbCols[j].setGravity(Gravity.CENTER); tbCols[j].setTypeface(Typeface.createFromAsset(tbCols[j].getContext().getAssets(), "InterparkGothicBold.ttf")); tbCols[j].setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent reviewIntent = new Intent(originActivity, ReviewDetailActivity.class); reviewIntent.putExtra("ACCESS", "STORE"); reviewIntent.putExtra("CID", elements[2]); reviewIntent.putExtra("LICENSE", license); Log.i("StoreReview", "StartActivity"); startActivity(reviewIntent); } }); Log.i("StoreMenu", "COL" + j + ":" + elements[j]); tbRow.addView(tbCols[j]); } reviewTable.addView(tbRow); } } reviewTable.removeViewAt(1); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.store_map); mapFragment.getMapAsync(this); }