List of usage examples for android.widget TextView TextView
public TextView(Context context)
From source file:com.max2idea.android.limbo.main.LimboActivity.java
private void promptPrio(final Activity activity) { // TODO Auto-generated method stub final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Enable High Priority!"); TextView textView = new TextView(activity); textView.setVisibility(View.VISIBLE); textView.setId(201012010);/*ww w . java 2 s . c o m*/ textView.setText( "Warning! High Priority might increase emulation speed but " + "will slow your phone down!"); alertDialog.setView(textView); final Handler handler = this.handler; // alertDialog.setMessage(body); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { LimboSettingsManager.setPrio(activity, true); } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mPrio.setChecked(false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mPrio.setChecked(false); } }); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public void promptVNCAllowExternal(final Activity activity) { final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Enable VNC server"); TextView textView = new TextView(activity); textView.setVisibility(View.VISIBLE); textView.setId(201012010);//from ww w . jav a 2s . c o m textView.setText("VNC Server: " + this.getLocalIpAddress() + ":" + "5901\n" + "Warning: VNC is not secure make sure you're on a private network!\n"); EditText passwdView = new EditText(activity); passwdView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); passwdView.setHint("Password"); passwdView.setEnabled(true); passwdView.setVisibility(View.VISIBLE); passwdView.setId(11111); passwdView.setSingleLine(); RelativeLayout mLayout = new RelativeLayout(this); mLayout.setId(12222); RelativeLayout.LayoutParams textViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); textViewParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, mLayout.getId()); mLayout.addView(textView, textViewParams); RelativeLayout.LayoutParams passwordViewParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); passwordViewParams.addRule(RelativeLayout.BELOW, textView.getId()); // passwordViewParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, // mLayout.getId()); mLayout.addView(passwdView, passwordViewParams); alertDialog.setView(mLayout); final Handler handler = this.handler; alertDialog.setButton("Set", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // UIUtils.log("Searching..."); EditText a = (EditText) alertDialog.findViewById(11111); if (a.getText().toString().trim().equals("")) { Toast.makeText(getApplicationContext(), "Password cannot be empty!", Toast.LENGTH_SHORT).show(); vnc_passwd = null; vnc_allow_external = 0; mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); return; } else { sendHandlerMessage(handler, Const.VNC_PASSWORD, "vnc_passwd", "passwd"); vnc_passwd = a.getText().toString(); vnc_allow_external = 1; // LimboSettingsManager.setVNCAllowExternal(activity, true); } } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { vnc_passwd = null; vnc_allow_external = 0; mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mVNCAllowExternal.setChecked(false); // LimboSettingsManager.setVNCAllowExternal(activity, false); vnc_passwd = null; vnc_allow_external = 0; } }); alertDialog.show(); }
From source file:com.max2idea.android.limbo.main.LimboActivity.java
public void promptMultiAIO(final Activity activity) { // if (!ICS) { // Toast.makeText(getApplicationContext(), // "Multithread AIO supported only for ICS and above!", // Toast.LENGTH_SHORT).show(); // this.mMultiAIO.setChecked(false); // return;//from w ww . j ava2 s . c om // } final AlertDialog alertDialog; alertDialog = new AlertDialog.Builder(activity).create(); alertDialog.setTitle("Warning!"); TextView info = new TextView(activity); info.setText("Enabling Multithreaded AIO might speed up I/O in the VM " + "but it might not work for all devices. " + "Multithreaded AIO is experimental and might damage any disk image you open with Limbo so keep a " + "backup of your images if you're not certain. " + "If you see errors uncheck this option and try again."); alertDialog.setView(info); final Handler handler = this.handler; alertDialog.setButton("Set", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { LimboSettingsManager.setMultiAIO(activity, true); } }); alertDialog.setButton2("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mMultiAIO.setChecked(false); LimboSettingsManager.setMultiAIO(activity, false); return; } }); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mMultiAIO.setChecked(false); LimboSettingsManager.setMultiAIO(activity, false); } }); alertDialog.show(); }
From source file:com.nest5.businessClient.Initialactivity.java
private void makeTable(String name) { table.removeAllViews();/*from w ww. j a va 2 s .c om*/ Iterator<Entry<Registrable, Integer>> it = currentOrder.entrySet().iterator(); int i = 0; while (it.hasNext()) { LinkedHashMap.Entry<Registrable, Integer> pairs = (LinkedHashMap.Entry<Registrable, Integer>) it.next(); // System.out.println(pairs.getKey() + " = " + pairs.getValue()); // it.remove(); // avoids a ConcurrentModificationException TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.table_row, null); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tQty = (TextView) tr.findViewById(R.id.cell_qty); TextView tPrice = (TextView) tr.findViewById(R.id.cell_price); ImageButton rmvBtn = (ImageButton) tr.findViewById(R.id.cell_remove_button); tItem.setText(pairs.getKey().name); tQty.setText(String.valueOf(pairs.getValue())); tPrice.setText(String.valueOf(pairs.getKey().price)); if (name == pairs.getKey().name) { tr.setBackgroundColor(Color.parseColor("#55222222")); } rmvBtn.setOnClickListener(removeClickListener); rmvBtn.setId(i); table.addView(tr); // Draw separator TextView tv = new TextView(mContext); tv.setBackgroundColor(Color.parseColor("#80808080")); tv.setHeight(2); table.addView(tv); inTableRegistrable.add(i, pairs.getKey()); i++; } }
From source file:com.nest5.businessClient.Initialactivity.java
private void makeDailyTable(int TABLE_TYPE) { dailyTable.removeAllViews();/* w w w.j av a2 s.co m*/ Double total = 0.0; DecimalFormat dec = new DecimalFormat("$###,###,###"); TextView tv = new TextView(mContext); tv.setBackgroundColor(Color.parseColor("#80808080")); tv.setHeight(2); TableRow tr1 = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate1 = (TextView) tr1.findViewById(R.id.cell_date); TextView tItem1 = (TextView) tr1.findViewById(R.id.cell_item); TextView tAccount1 = (TextView) tr1.findViewById(R.id.cell_account); TextView tVal1 = (TextView) tr1.findViewById(R.id.cell_value); TextView tTot1 = (TextView) tr1.findViewById(R.id.cell_total); tDate1.setText("FECHA"); tAccount1.setText("CUENTA"); tItem1.setText("ITEM"); tVal1.setText("VALOR"); tTot1.setText("TOTAL"); tr1.setBackgroundColor(Color.CYAN); dailyTable.addView(tr1); dailyTable.addView(tv); //actualizar sales de hoy Calendar today = Calendar.getInstance(); Calendar tomorrow = Calendar.getInstance(); today.set(Calendar.HOUR, 0); today.set(Calendar.HOUR_OF_DAY, 0); today.set(Calendar.MINUTE, 0); today.set(Calendar.SECOND, 0); today.set(Calendar.MILLISECOND, 0); tomorrow.roll(Calendar.DATE, 1); tomorrow.set(Calendar.HOUR, 0); tomorrow.set(Calendar.HOUR_OF_DAY, 0); tomorrow.set(Calendar.MINUTE, 0); tomorrow.set(Calendar.SECOND, 0); tomorrow.set(Calendar.MILLISECOND, 0); init = today.getTimeInMillis(); end = tomorrow.getTimeInMillis(); Log.d("GUARDANDOVENTA", today.toString()); Log.d("GUARDANDOVENTA", tomorrow.toString()); Calendar now = Calendar.getInstance(); now.setTimeInMillis(System.currentTimeMillis()); Log.d(TAG, now.toString()); Log.d(TAG, "Diferencia entre tiempos: " + String.valueOf(end - init)); salesFromToday = saleDataSource.getAllSalesWithin(init, end); List<Sale> usingSales = salesFromToday; switch (TABLE_TYPE) { case TABLE_TYPE_TODAY: usingSales = salesFromToday; break; case TABLE_TYPE_ALL: usingSales = saleList; break; } for (Sale currentSale : usingSales) { double totalLocal = 0.0; LinkedHashMap<Combo, Double> combos = currentSale.getCombos(); LinkedHashMap<Product, Double> products = currentSale.getProducts(); LinkedHashMap<Ingredient, Double> ingredients = currentSale.getIngredients(); Log.w("DAYILETABLES", " " + combos.size() + " " + products.size() + " " + ingredients.size()); Iterator<Entry<Combo, Double>> it = combos.entrySet().iterator(); Calendar date = Calendar.getInstance(); date.setTimeInMillis(currentSale.getDate()); String fecha = date.get(Calendar.MONTH) + "/" + date.get(Calendar.DAY_OF_MONTH) + "/" + date.get(Calendar.YEAR) + "\n" + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND); String account = currentSale.getPaymentMethod(); while (it.hasNext()) { TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); Map.Entry<Combo, Double> pair = (Map.Entry<Combo, Double>) it.next(); Double value = pair.getValue() * pair.getKey().getPrice(); tDate.setText(fecha); tAccount.setText(account); tItem.setText(pair.getKey().getName() + " en Combo"); tVal.setText(dec.format(value)); tTot.setText("----"); total += value; totalLocal += value; dailyTable.addView(tr); // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue()); } Iterator<Entry<Product, Double>> it2 = products.entrySet().iterator(); while (it2.hasNext()) { Map.Entry<Product, Double> pair = (Map.Entry<Product, Double>) it2.next(); TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); Double value = pair.getValue() * pair.getKey().getPrice(); tDate.setText(fecha); tAccount.setText(account); tItem.setText(pair.getKey().getName()); tVal.setText(dec.format(value)); tTot.setText("----"); total += value; totalLocal += value; dailyTable.addView(tr); // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue()); } Iterator<Entry<Ingredient, Double>> it3 = ingredients.entrySet().iterator(); while (it3.hasNext()) { Map.Entry<Ingredient, Double> pair = (Map.Entry<Ingredient, Double>) it3.next(); TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); Double value = pair.getValue() * pair.getKey().getPrice(); tDate.setText(fecha); tAccount.setText(account); tItem.setText(pair.getKey().getName()); tVal.setText(dec.format(value)); tTot.setText("----"); total += value; totalLocal += value; dailyTable.addView(tr); // Log.d("INGREDIENTES","INGREDIENTE: "+ingrediente.getKey().getName()+" "+ingrediente.getValue()); } TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tItem = (TextView) tr.findViewById(R.id.cell_item); TextView tAccount = (TextView) tr.findViewById(R.id.cell_account); TextView tVal = (TextView) tr.findViewById(R.id.cell_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total); tDate.setText(fecha); tAccount.setText("-------"); tItem.setText("Ingreso por Ventas"); tVal.setText("----"); tTot.setText(dec.format(totalLocal)); tr.setBackgroundColor(Color.LTGRAY); dailyTable.addView(tr); TableRow tr2 = (TableRow) getLayoutInflater().inflate(R.layout.daily_table_row, null); TextView tDate2 = (TextView) tr2.findViewById(R.id.cell_date); TextView tItem2 = (TextView) tr2.findViewById(R.id.cell_item); TextView tAccount2 = (TextView) tr2.findViewById(R.id.cell_account); TextView tVal2 = (TextView) tr2.findViewById(R.id.cell_value); TextView tTot2 = (TextView) tr2.findViewById(R.id.cell_total); tDate2.setText(fecha); tAccount2.setText("-------"); tItem2.setText("Acumulado por Ventas"); tVal2.setText("----"); tTot2.setText(dec.format(total)); tr2.setBackgroundColor(Color.GRAY); dailyTable.addView(tr2); } }
From source file:com.nest5.businessClient.Initialactivity.java
private void makeInventoryTable(List<Ingredient> ingredients) { inventoryTable.removeAllViews();/*from ww w . j av a 2 s . c o m*/ Double total = 0.0; DecimalFormat dec = new DecimalFormat("$###,###,###"); TextView tv = new TextView(mContext); tv.setBackgroundColor(Color.parseColor("#80808080")); tv.setHeight(2); TableRow tr1 = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null); TextView tDate1 = (TextView) tr1.findViewById(R.id.cell_date); TextView tItem1 = (TextView) tr1.findViewById(R.id.cell_type); TextView tAccount1 = (TextView) tr1.findViewById(R.id.cell_qty); TextView tVal1 = (TextView) tr1.findViewById(R.id.cell_unit_value); TextView tTot1 = (TextView) tr1.findViewById(R.id.cell_total_value); TextView tTotTot1 = (TextView) tr1.findViewById(R.id.cell_total_total); tDate1.setText("FECHA"); tAccount1.setText("CANTIDAD"); tItem1.setText("TIPO"); tVal1.setText("VALOR\nUNIDAD"); tTot1.setText("TOTAL\nITEM"); tTotTot1.setText("TOTAL"); tr1.setBackgroundColor(Color.CYAN); inventoryTable.addView(tr1); inventoryTable.addView(tv); for (Ingredient current : ingredients) { Calendar date = Calendar.getInstance(); date.setTimeInMillis(current.getDate()); String fecha = date.get(Calendar.MONTH) + "/" + date.get(Calendar.DAY_OF_MONTH) + "/" + date.get(Calendar.YEAR) + "\n" + date.get(Calendar.HOUR_OF_DAY) + ":" + date.get(Calendar.MINUTE) + ":" + date.get(Calendar.SECOND); Double localVal = current.getQty() * current.getCostPerUnit(); total += localVal; TableRow tr = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null); TextView tDate = (TextView) tr.findViewById(R.id.cell_date); TextView tType = (TextView) tr.findViewById(R.id.cell_type); TextView tQty = (TextView) tr.findViewById(R.id.cell_qty); TextView tVal = (TextView) tr.findViewById(R.id.cell_unit_value); TextView tTot = (TextView) tr.findViewById(R.id.cell_total_value); TextView tTotTot = (TextView) tr.findViewById(R.id.cell_total_total); tDate.setText(fecha); tType.setText("E"); tQty.setText(String.valueOf(current.getQty())); tVal.setText(dec.format(current.getCostPerUnit())); tTot.setText(dec.format(localVal)); tTotTot.setText(" ----- "); inventoryTable.addView(tr); } TableRow tr2 = (TableRow) getLayoutInflater().inflate(R.layout.inventory_table_row, null); TextView tDate2 = (TextView) tr2.findViewById(R.id.cell_date); TextView tType2 = (TextView) tr2.findViewById(R.id.cell_type); TextView tQty2 = (TextView) tr2.findViewById(R.id.cell_qty); TextView tVal2 = (TextView) tr2.findViewById(R.id.cell_unit_value); TextView tTot2 = (TextView) tr2.findViewById(R.id.cell_total_value); TextView tTotTot2 = (TextView) tr2.findViewById(R.id.cell_total_total); tDate2.setText("------"); tType2.setText("-----"); tQty2.setText("-----"); tVal2.setText("-----"); tTot2.setText("TOTAL GENERAL"); tTotTot2.setText(dec.format(total)); tr2.setBackgroundColor(Color.LTGRAY); inventoryTable.addView(tr2); }
From source file:com.skytree.epubtest.BookViewActivity.java
public TextView makeLabel(int id, String text, int gravity, float textSize, int textColor) { TextView label = new TextView(this); label.setId(id);/* www. j a v a 2 s. c om*/ label.setGravity(gravity); label.setBackgroundColor(Color.TRANSPARENT); label.setText(text); label.setTextColor(textColor); label.setTextSize(textSize); return label; }
From source file:com.guardtrax.ui.screens.HomeScreen.java
private void displaytourInfo() { String message = ""; int i = 0;// w ww .j av a2 s .co m int tagCount = 0; boolean singleDisplay = false; //indicates that only 1 item is to be displayed in the tour list List<Boolean> tourtagsIncluded = new ArrayList<Boolean>(); List<Boolean> tourtagsScanned = new ArrayList<Boolean>(); List<Integer> tourOrder = new ArrayList<Integer>(); List<String> messageList = new ArrayList<String>(); //check if this is a single display (second last character of tour name is a space) singleDisplay = isSingleRandomTour(); tourDB.open(); Cursor c = tourDB.getRecordByTour(GTConstants.tourName); if (c != null && c.moveToFirst()) { tourtagsScanned = refreshtourtagList(c.getCount(), false, true, false, false); tourtagsIncluded = refreshtourtagList(c.getCount(), false, false, true, false); tourOrder = gettourOrder(c.getCount()); //initialize the message array which wil be used to display the messages in the random order while (messageList.size() < c.getCount()) messageList.add(""); for (i = 0; i < c.getCount(); i++) { if (tourtagsScanned.get(i) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#00FF00'>" + c.getString(2) + "</font><br/>"); else if (!tourtagsScanned.get(i) && !Utility.istourOntime(tourEnd) && Utility.getcurrentState().equals(GTConstants.onShift) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#FF0000'>" + c.getString(2) + "</font><br/>"); else if (!tourtagsScanned.get(i) && tourtagsIncluded.get(i) && !singleDisplay) messageList.add(tourOrder.get(i), "<br><font color='#FFFFFF'>" + c.getString(2) + "</font><br/>"); else if (singleDisplay && i == touritemNumber) messageList.add(tourOrder.get(i), "<br><font color='#FFFFFF'>" + c.getString(2) + "</font><br/>"); //get the number of tags included if (tourtagsIncluded.get(i)) tagCount++; c.moveToNext(); } } tourDB.close(); //create the message string for (i = 0; i < messageList.size(); i++) if (messageList.get(i).length() > 1) message = message + messageList.get(i); LayoutInflater inflater = LayoutInflater.from(HomeScreen.this); View view = inflater.inflate(R.layout.scroll_dialog, null); TextView textview = (TextView) view.findViewById(R.id.dialogtext); textview.setText(Html.fromHtml(message)); AlertDialog.Builder alertDialog = new AlertDialog.Builder(HomeScreen.this); //create custom title TextView title = new TextView(HomeScreen.this); //if this is a single display tour then do not indicate how many tags are in the tour if (isSingleRandomTour()) //this is a single display tour title.setText(GTConstants.tourName + CRLF + tourTime + CRLF); else title.setText(GTConstants.tourName + CRLF + tourTime + CRLF + String.valueOf(tagCount) + " Tags"); title.setPadding(10, 10, 10, 10); title.setGravity(Gravity.CENTER); title.setTextColor(Color.parseColor("#79ABFF")); title.setTextSize(20); alertDialog.setCustomTitle(title); //alertDialog.setTitle(tourName + CRLF + String.valueOf(i-1) + " Tags"); alertDialog.setView(view); alertDialog.setPositiveButton("OK", null); AlertDialog alert = alertDialog.create(); alert.show(); }
From source file:self.philbrown.droidQuery.$.java
/** * Include the html string the selected views. If a view has a setText method, it is used. Otherwise, * a new TextView is created. This html can also handle image tags for both urls and local files. * Local files should be the name (for example, for R.id.ic_launcher, just use ic_launcher). * @param html the HTML String to include *///from www .jav a2 s . c o m public $ html(String html) { for (int i = 0; i < this.views.size(); i++) { View view = this.views.get(i); try { Method m = view.getClass().getMethod("setText", new Class<?>[] { CharSequence.class }); m.invoke(view, (CharSequence) Html.fromHtml(html)); } catch (Throwable t) { if (view instanceof ViewGroup) { try { //no setText method. Try a TextView TextView tv = new TextView(this.context); tv.setBackgroundColor(context.getResources().getColor(android.R.color.transparent)); tv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) view).addView(tv); tv.setText(Html.fromHtml(html, new AsyncImageGetter(tv), null)); } catch (Throwable t2) { //unable to set content Log.w("droidQuery", "unable to set HTML content"); } } else { //unable to set content Log.w("droidQuery", "unable to set textual content"); } } } return this; }
From source file:self.philbrown.droidQuery.$.java
/** * Includes the given text string inside of the selected views. If a view has a setText method, it is used * otherwise, if possible, a textview is added as a child to display the text. * @param text the text to include/*from w w w . j a v a2 s. c o m*/ */ public $ text(CharSequence text) { for (int i = 0; i < this.views.size(); i++) { View view = this.views.get(i); try { Method m = view.getClass().getMethod("setText", new Class<?>[] { CharSequence.class }); m.invoke(view, text); } catch (Throwable t) { if (view instanceof ViewGroup) { try { //no setText method. Try a TextView TextView tv = new TextView(this.context); tv.setBackgroundColor(context.getResources().getColor(android.R.color.transparent)); tv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); tv.setText(text); ((ViewGroup) view).addView(tv); } catch (Throwable t2) { //unable to set content Log.w("droidQuery", "unable to set textual content"); } } else { //unable to set content Log.w("droidQuery", "unable to set textual content"); } } } return this; }