List of usage examples for android.widget TableLayout removeAllViews
public void removeAllViews()
From source file:com.keysolutions.meteorparties.PartyDetailFragment.java
/** * Displays party info/* www. j a v a 2 s.c om*/ * @param savedInstanceState instance state * @param rootView view the party display elements are in */ public void showPartyInfo(Bundle savedInstanceState, View rootView) { ((TextView) rootView.findViewById(R.id.party_title)).setText(mParty.getTitle()); ((TextView) rootView.findViewById(R.id.party_description)).setText(mParty.getDescription()); // get ready to show my RSVP info String myUserId = MyDDPState.getInstance().getUserId(); // add RSVP list // NOTE: if you have a lot of RSVPs, you should be using a ListView // The TableLayout is used here to make it this demo simple to // understand if (mParty.getRsvps() != null) { TableLayout table = (TableLayout) rootView.findViewById(R.id.rsvp_list); table.removeAllViews(); // add header TableRow tr = (TableRow) getLayoutInflater(savedInstanceState).inflate(R.layout.header_party_rsvp, null); table.addView(tr); for (Map<String, String> rsvp : mParty.getRsvps()) { String rsvpValue = rsvp.get("rsvp"); String rsvpUser = rsvp.get("user"); if ((myUserId == null) || (!myUserId.equals(rsvpUser))) { // don't add row for my RSVP because that's displayed later tr = (TableRow) getLayoutInflater(savedInstanceState).inflate(R.layout.row_party_rsvp, null); TextView tv; tv = (TextView) tr.findViewById(R.id.user); String email = MyDDPState.getInstance().getUserEmail(rsvpUser); tv.setText(email); tv = (TextView) tr.findViewById(R.id.rsvp); String rsvpDisplayed = ""; int rsvpColor = 0; if (rsvpValue.equals("yes")) { rsvpDisplayed = "Going"; rsvpColor = 0xFF00FF00; } else if (rsvpValue.equals("no")) { rsvpDisplayed = "Declined"; rsvpColor = 0xFFFF0000; } else if (rsvpValue.equals("maybe")) { rsvpDisplayed = "Maybe"; rsvpColor = 0xFF0000FF; } tv.setText(rsvpDisplayed); tv.setTextColor(rsvpColor); table.addView(tr); } } } }
From source file:org.linphone.ContactFragment.java
@SuppressLint("InflateParams") private void displayContact(LayoutInflater inflater, View view) { AvatarWithShadow contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture); if (contact.getPhotoUri() != null) { InputStream input = Compatibility.getContactPictureInputStream( LinphoneActivity.instance().getContentResolver(), contact.getID()); contactPicture.setImageBitmap(BitmapFactory.decodeStream(input)); } else {/*from ww w .j a va2 s . c om*/ contactPicture.setImageResource(R.drawable.unknown_small); } TextView contactName = (TextView) view.findViewById(R.id.contactName); contactName.setText(contact.getName()); TableLayout controls = (TableLayout) view.findViewById(R.id.controls); controls.removeAllViews(); for (String numberOrAddress : contact.getNumbersOrAddresses()) { View v = inflater.inflate(R.layout.contact_control_row, null); String displayednumberOrAddress = numberOrAddress; if (numberOrAddress.startsWith("sip:")) { displayednumberOrAddress = displayednumberOrAddress.replace("sip:", ""); } TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress); tv.setText(displayednumberOrAddress); tv.setSelected(true); if (!displayChatAddressOnly) { v.findViewById(R.id.dial).setOnClickListener(dialListener); v.findViewById(R.id.dial).setTag(displayednumberOrAddress); } else { v.findViewById(R.id.dial).setVisibility(View.GONE); } v.findViewById(R.id.start_chat).setOnClickListener(chatListener); LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); if (lpc != null) { displayednumberOrAddress = lpc.normalizePhoneNumber(displayednumberOrAddress); if (!displayednumberOrAddress.startsWith("sip:")) { numberOrAddress = "sip:" + displayednumberOrAddress; } String tag = numberOrAddress; if (!numberOrAddress.contains("@")) { tag = numberOrAddress + "@" + lpc.getDomain(); } v.findViewById(R.id.start_chat).setTag(tag); } else { v.findViewById(R.id.start_chat).setTag(numberOrAddress); } final String finalNumberOrAddress = numberOrAddress; ImageView friend = (ImageView) v.findViewById(R.id.addFriend); if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) { friend.setVisibility(View.VISIBLE); boolean isAlreadyAFriend = LinphoneManager.getLc() .findFriendByAddress(finalNumberOrAddress) != null; if (!isAlreadyAFriend) { friend.setImageResource(R.drawable.friend_add); friend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (ContactsManager.getInstance().createNewFriend(contact, finalNumberOrAddress)) { displayContact(ContactFragment.this.inflater, ContactFragment.this.view); } } }); } else { friend.setImageResource(R.drawable.friend_remove); friend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (ContactsManager.getInstance().removeFriend(finalNumberOrAddress)) { displayContact(ContactFragment.this.inflater, ContactFragment.this.view); } } }); } } if (getResources().getBoolean(R.bool.disable_chat)) { v.findViewById(R.id.start_chat).setVisibility(View.GONE); } controls.addView(v); } }
From source file:nl.openkvk.MainActivity.java
private void globalSearchResults(Object obj) { {//w w w . jav a 2 s.co m Log.d("Result", obj.toString()); TableLayout tl = (TableLayout) findViewById(R.id.tableOuter); tl.removeAllViews(); JSONResult res = new JSONResult((JSONObject) ((JSONObject) ((JSONArray) obj).get(0)).get("RESULT")); if (res.size() < 1) { TextView v1 = new TextView(this); v1.setText("Niets gevonden voor deze zoekvraag."); TableRow tr = new TableRow(this); tr.addView(v1); tl.addView(tr); } for (int r = 0; r < res.size(); r++) { { TableRow tr = new TableRow(this); TextView v1 = new TextView(this); tr.addView(v1); tl.addView(tr); } print(tl, "Naam: ", res.getValue(r, "bedrijfsnaam")); print(tl, "KvK: ", res.getValue(r, "kvks")); print(tl, "VestNr: ", res.getValue(r, "vestiging")); print(tl, "Type: ", res.getValue(r, "type")); print(tl, "Rechtsvorm: ", res.getValue(r, "rechtsvorm")); print(tl, "Status: ", res.getValue(r, "status")); print(tl, "Website: ", res.getValue(r, "website")); print(tl, "ANBI: ", res.getValue(r, "anbi")); print(tl, "Adres: ", res.getValue(r, "adres")); String po = res.getValue(r, "postcode"); String pl = res.getValue(r, "plaats"); if (po != null || pl != null) { if (po == null) { print(tl, "", pl); } else if (pl == null) { print(tl, "", po); } else { print(tl, "", po + " " + pl); } } { TableRow tr = new TableRow(this); if (res.getValue(r, "kvk") != null && res.getValue(r, "kvks") != null) { Button but = new Button(this); but.setText("Details"); but.setTextSize(10); but.setOnClickListener(new KvkButListener(res.getValue(r, "kvk"), res.getValue(r, "kvks"))); tr.addView(but); } else { tr.addView(new TextView(this)); } tr.addView(new TextView(this)); if (po != null) { Button but = new Button(this); but.setText("Postcode"); but.setTextSize(10); but.setOnClickListener(new PostcodeButListener(po)); tr.addView(but); } tl.addView(tr); } } } }
From source file:se.frikod.payday.DailyBudgetFragment.java
private void updateBudgetItems() { TableLayout itemsTable = (TableLayout) V.findViewById(R.id.budgetItems); itemsTable.removeAllViews(); for (int i = 0; i < budget.budgetItems.size(); i++) { BudgetItem bi = budget.budgetItems.get(i); final int currentIndex = i; LayoutInflater inflater = activity.getLayoutInflater(); TableRow budgetItemView = (TableRow) inflater.inflate(R.layout.daily_budget_budget_item, itemsTable, false);/*from www . j a va2 s . com*/ TextView amount = (TextView) budgetItemView.findViewById(R.id.budgetItemAmount); TextView title = (TextView) budgetItemView.findViewById(R.id.budgetItemLabel); amount.setText(budget.formatter.format(bi.amount)); title.setText(bi.title); if (bi.exclude) { amount.setTextColor(0xffCCCCCC); amount.setPaintFlags(amount.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); title.setTextColor(0xffCCCCCC); title.setPaintFlags(title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); } budgetItemView.setClickable(true); budgetItemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Vibrator vibrator = (Vibrator) activity.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(10); BudgetItem bi = budget.budgetItems.get(currentIndex); bi.exclude = !bi.exclude; budget.saveBudgetItems(); updateBudgetItems(); } }); budgetItemView.setLongClickable(true); budgetItemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { editBudgetItem(v, currentIndex); return true; } }); itemsTable.addView(budgetItemView); } FontUtils.setRobotoFont(activity, itemsTable); updateBudget(); }
From source file:com.murrayc.galaxyzoo.app.QuestionHelpFragment.java
public void update() { // Use the Builder class for convenient dialog construction final Context context = getActivity(); final DecisionTree.Question question = getQuestion(); if (question == null) { Log.error("update(): question is null."); return;/*from w w w . jav a2s. c o m*/ } //Show the Help text: final TextView textView = (TextView) mRootView.findViewById(R.id.textView); if (textView == null) { Log.error("update(): textView is null."); return; } textView.setText(question.getHelp()); //Show the example images: final TableLayout tableLayout = (TableLayout) mRootView.findViewById(R.id.tableLayout); if (tableLayout == null) { Log.error("update(): tableLayout is null."); return; } tableLayout.removeAllViews(); for (final DecisionTree.Answer answer : question.getAnswers()) { addRowForAnswer(context, tableLayout, question, answer); } for (final DecisionTree.Checkbox checkbox : question.getCheckboxes()) { addRowForAnswer(context, tableLayout, question, checkbox); } }
From source file:nl.openkvk.MainActivity.java
public void searchInKvK(View view) { TableLayout tl = (TableLayout) findViewById(R.id.tableOuter); tl.removeAllViews(); EditText _naam = (EditText) findViewById(R.id.inpNaam); EditText _straat = (EditText) findViewById(R.id.inpStraat); EditText _postcode = (EditText) findViewById(R.id.inpPostcode); EditText _plaats = (EditText) findViewById(R.id.inpPlaats); EditText _hdlNaam = (EditText) findViewById(R.id.inpHandelsNaam); String naam = _naam.getText().toString().trim(); String hdlNaam = _hdlNaam.getText().toString().trim(); String straat = _straat.getText().toString().trim(); String postcode = _postcode.getText().toString().trim().toUpperCase(); if (postcode.indexOf(' ') > 0) { postcode = postcode.replace(" ", ""); }/* w ww . j a va 2 s.c o m*/ String plaats = _plaats.getText().toString().trim(); _naam.setText(naam); _hdlNaam.setText(hdlNaam); _straat.setText(straat); _postcode.setText(postcode); _plaats.setText(plaats); String sql = null; if (naam.length() > 0) { try { Integer kvk = Integer.valueOf(naam); sql = "/json/select * from kvk where kvks=" + kvk; } catch (Exception ignore) { sql = "/json/select * from kvk where bedrijfsnaam ilike '" + naam + "%'"; } if (straat.length() > 0) { sql += " and adres ilike '" + straat + "%'"; } if (plaats.length() > 0) { sql += " and plaats ilike '" + plaats + "%'"; } if (postcode.length() > 0) { sql += " and postcode ilike '" + postcode + "%'"; } sql += " LIMIT 1000;"; } else if (hdlNaam.length() > 0) { sql = "/json/select * from kvk,kvk_handelsnamen where kvk.kvks=kvk_handelsnamen.kvks and handelsnaam ilike '" + hdlNaam + "%'"; sql += " LIMIT 1000;"; } else if (straat.length() > 0 && (plaats.length() > 0 || postcode.length() > 0)) { sql = "/json/select * from kvk where adres ilike '" + straat + "%'"; if (plaats.length() > 0) { sql += " and plaats ilike '" + plaats + "%'"; } if (postcode.length() > 0) { sql += " and postcode ilike '" + postcode + "%'"; } sql += " LIMIT 1000;"; } else if (postcode.length() == 6) { sql = "/json/select * from kvk where postcode='" + postcode + "'"; sql += " LIMIT 1000;"; } if (sql != null) { TextView tv = new TextView(this); tv.setText("Even geduld AUB..."); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); new Caller(handler, handler.holder, sql, 2).start(); } else { { TextView tv = new TextView(this); tv.setText("Ongeldige invoer."); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Geef een (gedeelte van) een bedrijfsnaam in. Of geef het KvK nummer."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Geef eventueel ook (het begin van) een straat, postcode en/of plaatsnaam in."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Of geef een straat (mag met huisnummer) en een plaats en/of een postcode in."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } { TextView tv = new TextView(this); tv.setText("Of geef alleen een volledige postcode in."); tv.setSingleLine(false); TableRow tr = new TableRow(this); tr.addView(tv); tl.addView(tr); } } }
From source file:org.xingjitong.ContactFragment.java
private void displayContact(LayoutInflater inflater, View view) { AvatarWithShadow contactPicture = (AvatarWithShadow) view.findViewById(R.id.contactPicture); if (contact.getPhotoUri() != null) { InputStream input = Compatibility.getContactPictureInputStream(getActivity().getContentResolver(), contact.getID());//from w w w .j ava 2 s . co m contactPicture.setImageBitmap(BitmapFactory.decodeStream(input)); } else { contactPicture.setImageResource(R.drawable.unknown_small); } TextView contactName = (TextView) view.findViewById(R.id.contactName); contactName.setText(contact.getName()); contactName.setTextColor(Color.BLACK); View view2 = inflater.inflate(R.layout.edit_contact, null); TableLayout controls = (TableLayout) view2.findViewById(R.id.controls); if (controls.getChildCount() > 0 && controls != null) { controls.removeAllViews(); } for (String numberOrAddress : contact.getNumerosOrAddresses()) { //yyppdialog View v = inflater.inflate(R.layout.contact_control_row, null); String displayednumberOrAddress = numberOrAddress; if (numberOrAddress.startsWith("sip:")) { displayednumberOrAddress = displayednumberOrAddress.substring(4); } TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress); tv.setText(displayednumberOrAddress); tv.setSelected(true); if (!displayChatAddressOnly) { //yyppcontact //yyppdialog v.findViewById(R.id.dial).setOnClickListener(dialListener); v.findViewById(R.id.dial).setTag(displayednumberOrAddress); } else { v.findViewById(R.id.dial).setVisibility(View.GONE); } v.findViewById(R.id.chat).setOnClickListener(chatListener); if (LinphoneUtils.isSipAddress(numberOrAddress)) { v.findViewById(R.id.chat).setTag(numberOrAddress); } else { LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); if (lpc != null) { if (!numberOrAddress.startsWith("sip:")) { numberOrAddress = "sip:" + numberOrAddress; } v.findViewById(R.id.chat).setTag(numberOrAddress + "@" + lpc.getDomain()); } } final String finalNumberOrAddress = numberOrAddress; ImageView friend = (ImageView) v.findViewById(R.id.addFriend); if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) { friend.setVisibility(View.VISIBLE); boolean isAlreadyAFriend = LinphoneManager.getLc() .findFriendByAddress(finalNumberOrAddress) != null; if (!isAlreadyAFriend) { friend.setImageResource(R.drawable.friend_add); friend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (LinphoneActivity.instance().newFriend(contact, finalNumberOrAddress)) { displayContact(ContactFragment.this.inflater, ContactFragment.this.view); } } }); } else { friend.setImageResource(R.drawable.friend_remove); friend.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (LinphoneActivity.instance().removeFriend(contact, finalNumberOrAddress)) { displayContact(ContactFragment.this.inflater, ContactFragment.this.view); } } }); } } if (getResources().getBoolean(R.bool.disable_chat)) { v.findViewById(R.id.chat).setVisibility(View.GONE); } controls.addView(v); } }
From source file:com.cssweb.android.quote.QuoteDetail.java
/** * // w w w . j a v a 2 s .c o m * @param jArr * @param table * @param zrsp * @throws JSONException */ private void appendRow(JSONArray jArr, TableLayout table, double zrsp) throws JSONException { table.setStretchAllColumns(true); table.removeAllViews(); if ("cf".equals(exchange.toLowerCase()) || "dc".equals(exchange.toLowerCase()) || "sf".equals(exchange.toLowerCase()) || "cz".equals(exchange.toLowerCase())) { int len = jArr.length(); int color = Utils.getTextColor(mContext, 0); for (int i = 0; i < len; i++) { LinearLayout linearLayout = (LinearLayout) findViewById(R.id.title23); linearLayout.setVisibility(View.VISIBLE); JSONArray jA = (JSONArray) jArr.get(i); TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1); TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2); TextView t3 = (TextView) row.findViewById(R.id.zr_table_col3); TextView t4 = (TextView) row.findViewById(R.id.zr_table_col4); TextView t5 = (TextView) row.findViewById(R.id.zr_table_col5); t1.setText(jA.getString(4)); t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type))); t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp)); t2.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); double cjsl = Arith.round(jA.getDouble(1), 0); t3.setText(Utils.dataFormation(cjsl, 0)); t3.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); t4.setText(jA.getString(7)); t5.setText(jA.getString(8)); table.addView(row); if ("B".equals(jA.getString(6))) { color = Utils.getTextColor(mContext, 3); t3.setTextColor(color); t4.setTextColor(color); t5.setTextColor(color); } else if ("S".equals(jA.getString(6))) { color = Utils.getTextColor(mContext, 4); t3.setTextColor(color); t4.setTextColor(color); t5.setTextColor(color); } else { t3.setTextColor(color); t4.setTextColor(color); t5.setTextColor(color); } } } else { if (stocktype.charAt(0) == '0') {// //for (int i = jArr.length()-1; i >= 0; i--) { for (int i = 0; i <= jArr.length() - 1; i++) { JSONArray jA = (JSONArray) jArr.get(i); TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1); TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2); TextView t3 = (TextView) row.findViewById(R.id.zr_table_col3); TextView t4 = (TextView) row.findViewById(R.id.zr_table_col4); t1.setText(jA.getString(4)); t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type))); t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp)); t2.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); double cjsl = Arith.round(jA.getDouble(1), 0); t3.setText(Utils.dataFormation(cjsl, 0)); if (cjsl > 500) t3.setTextColor(Utils.getTextColor(mContext, 6)); else t3.setTextColor(Utils.getTextColor(mContext, 1)); t3.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL); t4.setText(jA.getString(6)); if ("B".equals(jA.getString(6))) t4.setTextColor(Utils.getTextColor(mContext, 3)); else t4.setTextColor(Utils.getTextColor(mContext, 4)); table.addView(row); } //? int num = jArr.length(); if (num < 16) { while (num < 16) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); table.addView(row); num++; } } } else if (stocktype.charAt(0) == '1' || stocktype.charAt(0) == '2') {// //for (int i = jArr.length()-1; i >= 0; i--) { for (int i = 0; i <= jArr.length() - 1; i++) { JSONArray jA = (JSONArray) jArr.get(i); TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); TextView t1 = (TextView) row.findViewById(R.id.zr_table_col1); TextView t2 = (TextView) row.findViewById(R.id.zr_table_col2); TextView t3 = (TextView) row.findViewById(R.id.zr_table_col4); t1.setText(jA.getString(4)); t2.setText(Utils.dataFormation(jA.getDouble(0), Utils.getStockDigit(type))); t2.setTextColor(Utils.getTextColor(mContext, jA.getDouble(0), zrsp)); t3.setText(Utils.getAmountFormat(jA.getDouble(5), true)); t3.setTextColor(Utils.getTextColor(mContext, 1)); table.addView(row); } //? int num = jArr.length(); if (num < 16) { while (num < 16) { TableRow row = (TableRow) LayoutInflater.from(this).inflate(R.layout.zr_quote_price_item, null); table.addView(row); num++; } } } } }
From source file:com.QuarkLabs.BTCeClient.fragments.HomeFragment.java
/** * Refreshes funds table with fetched data * * @param response JSONObject with funds data *///from w ww .jav a2 s.co m private void refreshFunds(JSONObject response) { try { if (response == null) { Toast.makeText(getActivity(), getResources().getString(R.string.GeneralErrorText), Toast.LENGTH_LONG).show(); return; } String notificationText; if (response.getInt("success") == 1) { View.OnClickListener fillAmount = new View.OnClickListener() { @Override public void onClick(View v) { ScrollView scrollView = (ScrollView) getView(); if (scrollView != null) { EditText tradeAmount = (EditText) scrollView.findViewById(R.id.TradeAmount); tradeAmount.setText(((TextView) v).getText()); scrollView.smoothScrollTo(0, scrollView.findViewById(R.id.tradingSection).getBottom()); } } }; notificationText = getResources().getString(R.string.FundsInfoUpdatedtext); TableLayout fundsContainer = (TableLayout) getView().findViewById(R.id.FundsContainer); fundsContainer.removeAllViews(); JSONObject funds = response.getJSONObject("return").getJSONObject("funds"); JSONArray fundsNames = response.getJSONObject("return").getJSONObject("funds").names(); List<String> arrayList = new ArrayList<>(); for (int i = 0; i < fundsNames.length(); i++) { arrayList.add(fundsNames.getString(i)); } Collections.sort(arrayList); TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1); for (String anArrayList : arrayList) { TableRow row = new TableRow(getActivity()); TextView currency = new TextView(getActivity()); TextView amount = new TextView(getActivity()); currency.setText(anArrayList.toUpperCase(Locale.US)); amount.setText(funds.getString(anArrayList)); currency.setLayoutParams(layoutParams); currency.setTypeface(Typeface.DEFAULT, Typeface.BOLD); currency.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); currency.setGravity(Gravity.CENTER); amount.setLayoutParams(layoutParams); amount.setGravity(Gravity.CENTER); amount.setOnClickListener(fillAmount); row.addView(currency); row.addView(amount); fundsContainer.addView(row); } } else { notificationText = response.getString("error"); } mCallback.makeNotification(ConstantHolder.ACCOUNT_INFO_NOTIF_ID, notificationText); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.bonsai.wallet32.MainActivity.java
private void updateBalances() { if (mWalletService == null) return;/*from w w w.j a v a 2 s. c o m*/ TableLayout table = (TableLayout) findViewById(R.id.balance_table); // Clear any existing table content. table.removeAllViews(); addBalanceHeader(table); long sumbtc = 0; List<Balance> balances = mWalletService.getBalances(); if (balances != null) { for (Balance bal : balances) { sumbtc += bal.balance; addBalanceRow(table, bal.accountId, bal.accountName, bal.balance, mBTCFmt.fiatAtRate(bal.balance, mFiatPerBTC)); } } addBalanceSum(table, "Total", sumbtc, mBTCFmt.fiatAtRate(sumbtc, mFiatPerBTC)); }