public void populate(Cursor entries, Integer total_classes) { TextView rollno = (TextView) baseLayout.findViewWithTag("rollno"); rollno.setText(((Integer) entries.getInt(0)).toString()); TextView no_classes = (TextView) baseLayout.findViewWithTag("no_classes"); no_classes.setText(((Integer) entries.getInt(1)).toString() + "/" + total_classes); TextView percentage = (TextView) baseLayout.findViewWithTag("percentage"); Integer perc = (entries.getInt(1) / total_classes) * 100; percentage.setText(perc.toString()); }
public void handleMessage(android.os.Message msg) { switch (msg.what) { case 0: gridItemEntity gie = (gridItemEntity) msg.obj; if (gie != null) { int num = displayHeight / itemh; num = num == 0 ? 1 : num; LinearLayout ll; if ((currentCount - 1) % num > 0) { ll = (LinearLayout) data.findViewWithTag("columnId_" + currentConlumID); } else { ll = (LinearLayout) mInflater.inflate(R.layout.item_column, null); currentConlumID--; ll.setTag("columnId_" + currentConlumID); for (int j = 0; j < num; j++) { LinearLayout child = new LinearLayout(GridImageView.this); child.setLayoutParams(new LayoutParams(itemw, itemh)); child.setTag("item_" + j); ll.addView(child); } data.addView(ll); } int step = currentCount % num - 1; if (step == -1) { step = num - 1; } LinearLayout child = (LinearLayout) ll.findViewWithTag("item_" + step); // child.setBackgroundColor(R.color.bright_text_dark_focused); child.setBackgroundResource(R.drawable.grid_selector); child.setTag(gie); child.setOnClickListener(imageClick); child.setPadding(10, 10, 10, 10); // ImageView v = new ImageView(GridImageView.this); // v.setLayoutParams(new LayoutParams(itemw,itemh)); v.setImageDrawable(gie.image); child.addView(v); currentCount++; } break; default: break; } // removeMessages(msg.what); }
public void stateUpdate(final ObdCommandJob job) { final String cmdName = job.getCommand().getName(); String cmdResult = ""; final String cmdID = LookUpCommand(cmdName); if (job.getState().equals(ObdCommandJob.ObdCommandJobState.EXECUTION_ERROR)) { cmdResult = job.getCommand().getResult(); if (cmdResult != null) { obdStatusTextView.setText(cmdResult.toLowerCase()); } } else if (job.getState().equals(ObdCommandJob.ObdCommandJobState.NOT_SUPPORTED)) { cmdResult = getString(R.string.status_obd_no_support); } else { cmdResult = job.getCommand().getFormattedResult(); obdStatusTextView.setText(getString(R.string.status_obd_data)); } if (vv.findViewWithTag(cmdID) != null) { TextView existingTV = (TextView) vv.findViewWithTag(cmdID); existingTV.setText(cmdResult); } else addTableRow(cmdID, cmdName, cmdResult); commandResult.put(cmdID, cmdResult); updateTripStatistic(job, cmdID); }
public void setCurrentItem(int currentItem) { if (currentItem < 0) currentItem = 0; if (currentItem > count) currentItem = count; this.currentItem = currentItem; for (int i = 0; i < count; i++) { TextView textview = (TextView) layout_tabs.findViewWithTag(i); if (textview != null) { if (currentItem == i) { textview.setTextColor(textColorSelect); // LayoutParams params = // ((LayoutParams)line_current.getLayoutParams()); // params.leftMargin = line_current.getWidth()*currentItem; // line_current.setLayoutParams(params); } else { textview.setTextColor(textColorDefault); } } } int offset = (line_current.getWidth() + (under_line_margin)) * currentItem; setLineOffset(offset); }