List of usage examples for android.text.format DateFormat getDateFormat
public static java.text.DateFormat getDateFormat(Context context)
From source file:com.androzic.waypoint.WaypointDetails.java
@SuppressLint("NewApi") private void updateWaypointDetails(double lat, double lon) { Androzic application = Androzic.getApplication(); AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.getSupportActionBar().setTitle(waypoint.name); View view = getView();/* www .ja v a 2s .co m*/ final TextView coordsView = (TextView) view.findViewById(R.id.coordinates); coordsView.requestFocus(); coordsView.setTag(Integer.valueOf(StringFormatter.coordinateFormat)); coordsView.setText(StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude)); coordsView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int format = ((Integer) coordsView.getTag()).intValue() + 1; if (format == 5) format = 0; coordsView.setText(StringFormatter.coordinates(format, " ", waypoint.latitude, waypoint.longitude)); coordsView.setTag(Integer.valueOf(format)); } }); if (waypoint.altitude != Integer.MIN_VALUE) { ((TextView) view.findViewById(R.id.altitude)) .setText("\u2336 " + StringFormatter.elevationH(waypoint.altitude)); view.findViewById(R.id.altitude).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.altitude).setVisibility(View.GONE); } if (waypoint.proximity > 0) { ((TextView) view.findViewById(R.id.proximity)) .setText("~ " + StringFormatter.distanceH(waypoint.proximity)); view.findViewById(R.id.proximity).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.proximity).setVisibility(View.GONE); } double dist = Geo.distance(lat, lon, waypoint.latitude, waypoint.longitude); double bearing = Geo.bearing(lat, lon, waypoint.latitude, waypoint.longitude); bearing = application.fixDeclination(bearing); String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing); ((TextView) view.findViewById(R.id.distance)).setText(distance); ((TextView) view.findViewById(R.id.waypointset)).setText(waypoint.set.name); if (waypoint.date != null) { view.findViewById(R.id.date_row).setVisibility(View.VISIBLE); ((TextView) view.findViewById(R.id.date)) .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " " + DateFormat.getTimeFormat(activity).format(waypoint.date)); } else { view.findViewById(R.id.date_row).setVisibility(View.GONE); } if ("".equals(waypoint.description)) { view.findViewById(R.id.description_row).setVisibility(View.GONE); } else { WebView description = (WebView) view.findViewById(R.id.description); String descriptionHtml; try { TypedValue tv = new TypedValue(); Theme theme = activity.getTheme(); Resources resources = getResources(); theme.resolveAttribute(android.R.attr.textColorPrimary, tv, true); int secondaryColor = resources.getColor(tv.resourceId); String css = String.format( "<style type=\"text/css\">html,body{margin:0;background:transparent} *{color:#%06X}</style>\n", (secondaryColor & 0x00FFFFFF)); descriptionHtml = css + waypoint.description; description.setWebViewClient(new WebViewClient() { @SuppressLint("NewApi") @Override public void onPageFinished(WebView view, String url) { view.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) view.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } }); description.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) description.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } catch (Resources.NotFoundException e) { description.setBackgroundColor(Color.LTGRAY); descriptionHtml = waypoint.description; } WebSettings settings = description.getSettings(); settings.setDefaultTextEncodingName("utf-8"); settings.setAllowFileAccess(true); Uri baseUrl = Uri.fromFile(new File(application.dataPath)); description.loadDataWithBaseURL(baseUrl.toString() + "/", descriptionHtml, "text/html", "utf-8", null); view.findViewById(R.id.description_row).setVisibility(View.VISIBLE); } }
From source file:org.sufficientlysecure.keychain.ui.adapter.SubkeysAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { TextView vKeyId = (TextView) view.findViewById(R.id.subkey_item_key_id); TextView vKeyDetails = (TextView) view.findViewById(R.id.subkey_item_details); TextView vKeyExpiry = (TextView) view.findViewById(R.id.subkey_item_expiry); ImageView vCertifyIcon = (ImageView) view.findViewById(R.id.subkey_item_ic_certify); ImageView vSignIcon = (ImageView) view.findViewById(R.id.subkey_item_ic_sign); ImageView vEncryptIcon = (ImageView) view.findViewById(R.id.subkey_item_ic_encrypt); ImageView vAuthenticateIcon = (ImageView) view.findViewById(R.id.subkey_item_ic_authenticate); ImageView vEditImage = (ImageView) view.findViewById(R.id.subkey_item_edit_image); ImageView vStatus = (ImageView) view.findViewById(R.id.subkey_item_status); // not used:/* w w w.ja v a 2s. com*/ ImageView deleteImage = (ImageView) view.findViewById(R.id.subkey_item_delete_button); deleteImage.setVisibility(View.GONE); long keyId = cursor.getLong(INDEX_KEY_ID); vKeyId.setText(KeyFormattingUtils.beautifyKeyId(keyId)); // may be set with additional "stripped" later on SpannableStringBuilder algorithmStr = new SpannableStringBuilder(); algorithmStr.append(KeyFormattingUtils.getAlgorithmInfo(context, cursor.getInt(INDEX_ALGORITHM), cursor.getInt(INDEX_KEY_SIZE), cursor.getString(INDEX_KEY_CURVE_OID))); SubkeyChange change = mSaveKeyringParcel != null ? mSaveKeyringParcel.getSubkeyChange(keyId) : null; if (change != null && (change.mDummyStrip || change.mMoveKeyToSecurityToken)) { if (change.mDummyStrip) { algorithmStr.append(", "); final SpannableString boldStripped = new SpannableString(context.getString(R.string.key_stripped)); boldStripped.setSpan(new StyleSpan(Typeface.BOLD), 0, boldStripped.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); algorithmStr.append(boldStripped); } if (change.mMoveKeyToSecurityToken) { algorithmStr.append(", "); final SpannableString boldDivert = new SpannableString(context.getString(R.string.key_divert)); boldDivert.setSpan(new StyleSpan(Typeface.BOLD), 0, boldDivert.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); algorithmStr.append(boldDivert); } } else { switch (SecretKeyType.fromNum(cursor.getInt(INDEX_HAS_SECRET))) { case GNU_DUMMY: algorithmStr.append(", "); algorithmStr.append(context.getString(R.string.key_stripped)); break; case DIVERT_TO_CARD: algorithmStr.append(", "); algorithmStr.append(context.getString(R.string.key_divert)); break; case PASSPHRASE_EMPTY: algorithmStr.append(", "); algorithmStr.append(context.getString(R.string.key_no_passphrase)); break; case UNAVAILABLE: // don't show this on pub keys //algorithmStr += ", " + context.getString(R.string.key_unavailable); break; } } vKeyDetails.setText(algorithmStr, TextView.BufferType.SPANNABLE); boolean isMasterKey = cursor.getInt(INDEX_RANK) == 0; if (isMasterKey) { vKeyId.setTypeface(null, Typeface.BOLD); } else { vKeyId.setTypeface(null, Typeface.NORMAL); } // Set icons according to properties vCertifyIcon.setVisibility(cursor.getInt(INDEX_CAN_CERTIFY) != 0 ? View.VISIBLE : View.GONE); vEncryptIcon.setVisibility(cursor.getInt(INDEX_CAN_ENCRYPT) != 0 ? View.VISIBLE : View.GONE); vSignIcon.setVisibility(cursor.getInt(INDEX_CAN_SIGN) != 0 ? View.VISIBLE : View.GONE); vAuthenticateIcon.setVisibility(cursor.getInt(INDEX_CAN_AUTHENTICATE) != 0 ? View.VISIBLE : View.GONE); boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0; Date expiryDate = null; if (!cursor.isNull(INDEX_EXPIRY)) { expiryDate = new Date(cursor.getLong(INDEX_EXPIRY) * 1000); } // for edit key if (mSaveKeyringParcel != null) { boolean revokeThisSubkey = (mSaveKeyringParcel.mRevokeSubKeys.contains(keyId)); if (revokeThisSubkey) { if (!isRevoked) { isRevoked = true; } } SaveKeyringParcel.SubkeyChange subkeyChange = mSaveKeyringParcel.getSubkeyChange(keyId); if (subkeyChange != null) { if (subkeyChange.mExpiry == null || subkeyChange.mExpiry == 0L) { expiryDate = null; } else { expiryDate = new Date(subkeyChange.mExpiry * 1000); } } vEditImage.setVisibility(View.VISIBLE); } else { vEditImage.setVisibility(View.GONE); } boolean isExpired; if (expiryDate != null) { isExpired = expiryDate.before(new Date()); Calendar expiryCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); expiryCal.setTime(expiryDate); // convert from UTC to time zone of device expiryCal.setTimeZone(TimeZone.getDefault()); vKeyExpiry.setText(context.getString(R.string.label_expiry) + ": " + DateFormat.getDateFormat(context).format(expiryCal.getTime())); } else { isExpired = false; vKeyExpiry.setText(context.getString(R.string.label_expiry) + ": " + context.getString(R.string.none)); } // if key is expired or revoked... boolean isInvalid = isRevoked || isExpired; if (isInvalid) { vStatus.setVisibility(View.VISIBLE); vCertifyIcon.setColorFilter(mContext.getResources().getColor(R.color.key_flag_gray), PorterDuff.Mode.SRC_IN); vSignIcon.setColorFilter(mContext.getResources().getColor(R.color.key_flag_gray), PorterDuff.Mode.SRC_IN); vEncryptIcon.setColorFilter(mContext.getResources().getColor(R.color.key_flag_gray), PorterDuff.Mode.SRC_IN); vAuthenticateIcon.setColorFilter(mContext.getResources().getColor(R.color.key_flag_gray), PorterDuff.Mode.SRC_IN); if (isRevoked) { vStatus.setImageResource(R.drawable.status_signature_revoked_cutout_24dp); vStatus.setColorFilter(mContext.getResources().getColor(R.color.key_flag_gray), PorterDuff.Mode.SRC_IN); } else if (isExpired) { vStatus.setImageResource(R.drawable.status_signature_expired_cutout_24dp); vStatus.setColorFilter(mContext.getResources().getColor(R.color.key_flag_gray), PorterDuff.Mode.SRC_IN); } } else { vStatus.setVisibility(View.GONE); vKeyId.setTextColor(mDefaultTextColor); vKeyDetails.setTextColor(mDefaultTextColor); vKeyExpiry.setTextColor(mDefaultTextColor); vCertifyIcon.clearColorFilter(); vSignIcon.clearColorFilter(); vEncryptIcon.clearColorFilter(); vAuthenticateIcon.clearColorFilter(); } vKeyId.setEnabled(!isInvalid); vKeyDetails.setEnabled(!isInvalid); vKeyExpiry.setEnabled(!isInvalid); }
From source file:org.alfresco.mobile.android.application.fragments.search.AdvancedSearchFragment.java
private void initDocFolderForm() { // Retrieve editText editName = (EditText) rootView.findViewById(R.id.metadata_prop_name); editTitle = (EditText) rootView.findViewById(R.id.metadata_prop_title); editDescription = (EditText) rootView.findViewById(R.id.metadata_prop_description); // Spinner Mimetype spinnerMimeType = (Spinner) rootView.findViewById(R.id.metadata_prop_mimetype); if (searchKey != HistorySearch.TYPE_FOLDER) { spinnerMimeType.setAdapter(new MimetypeAdapter(getActivity())); } else {/*from w w w .j a va2s . c om*/ rootView.findViewById(R.id.metadata_prop_mimetype_header).setVisibility(View.GONE); spinnerMimeType.setVisibility(View.GONE); } // Last Modification date // TO ImageButton ib = (ImageButton) rootView.findViewById(R.id.action_metadata_modification_date_to); ib.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DatePickerFragment.newInstance(DATE_TO, TAG).show(getFragmentManager(), DatePickerFragment.TAG); } }); modificationDateTo = (Button) rootView.findViewById(R.id.metadata_modification_date_to); if (modificationDateToValue != null) { modificationDateTo .setText(DateFormat.getDateFormat(getActivity()).format(modificationDateToValue.getTime())); } modificationDateTo.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DatePickerFragment.newInstance(DATE_TO, TAG).show(getFragmentManager(), DatePickerFragment.TAG); } }); // FROM ib = (ImageButton) rootView.findViewById(R.id.action_metadata_modification_date_from); ib.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DatePickerFragment.newInstance(DATE_FROM, TAG).show(getFragmentManager(), DatePickerFragment.TAG); } }); modificationDateFrom = (Button) rootView.findViewById(R.id.metadata_modification_date_from); if (modificationDateFromValue != null) { modificationDateFrom .setText(DateFormat.getDateFormat(getActivity()).format(modificationDateFromValue.getTime())); } modificationDateFrom.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DatePickerFragment.newInstance(DATE_FROM, TAG).show(getFragmentManager(), DatePickerFragment.TAG); } }); ib = (ImageButton) rootView.findViewById(R.id.action_metadata_modification_date_from); ib.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { DatePickerFragment.newInstance(DATE_FROM, TAG).show(getFragmentManager(), DatePickerFragment.TAG); } }); // Last Modification by if (getSession() instanceof CloudSession) { rootView.findViewById(R.id.modified_by_group).setVisibility(View.GONE); } else { rootView.findViewById(R.id.modified_by_group).setVisibility(View.VISIBLE); ib = (ImageButton) rootView.findViewById(R.id.action_metadata_prop_modified_by); modifiedByButton = (Button) rootView.findViewById(R.id.metadata_prop_modified_by); ib.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startPersonPicker(); } }); modifiedByButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { startPersonPicker(); } }); } // BUTTON Button validationButton = UIUtils.initValidation(rootView, R.string.search); validationButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { search(); } }); Button clear = UIUtils.initCancel(rootView, R.string.clear); clear.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { clear(); } }); // ACCESSIBILITY if (AccessibilityUtils.isEnabled(getActivity())) { AccessibilityUtils.addHint(rootView.findViewById(R.id.metadata_prop_name), R.string.metadata_prop_name); AccessibilityUtils.addHint(rootView.findViewById(R.id.metadata_prop_title), R.string.metadata_prop_title); AccessibilityUtils.addHint(rootView.findViewById(R.id.metadata_prop_description), R.string.metadata_prop_description); } }
From source file:com.handpoint.headstart.client.ui.ReceiptActivity.java
private void initReceiptView() { Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/roboto-regular.ttf"); TextView merchantName = (TextView) findViewById(R.id.merchant_name); merchantName.setTypeface(tf, Typeface.BOLD); merchantName.setText(getMerchantName()); TextView transactionDateView = (TextView) findViewById(R.id.date); java.text.DateFormat df = DateFormat.getDateFormat(this); transactionDateView.setTypeface(tf); transactionDateView.setText(" " + df.format(mResult.getDateTime())); TextView transactionResult = (TextView) findViewById(R.id.transaction_result); transactionResult.setTypeface(tf, Typeface.BOLD); transactionResult.setText(mResult.getFinancialStatus()); TextView messageView = (TextView) findViewById(R.id.message); messageView.setTypeface(tf);/*from w w w. j a v a 2s . com*/ String message = ((Application) getApplication()).formatErrorMessage(mResult.getStatusMessage(), mResult.getErrorMessage()); messageView.setText(message); ImageView cardSchemeLogo = (ImageView) findViewById(R.id.card_scheme_logo); cardSchemeLogo.setImageDrawable(getCardSchemeLogo()); TextView amountView = (TextView) findViewById(R.id.amount_text); amountView.setTypeface(tf); amountView.setText(getTotalAmount(mResult.getAuthorizedAmount(), mResult.getCurrency())); TextView descriptionView = (TextView) findViewById(R.id.item_description_text); descriptionView.setTypeface(tf); descriptionView.setText(getDescriptionText()); ImageView productImageView = (ImageView) findViewById(R.id.picture); productImageView.setImageBitmap(getImageBitmap()); }
From source file:org.thialfihar.android.apg.ui.ViewKeyMainFragment.java
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) switch (loader.getId()) { case LOADER_ID_KEYRING: if (data.moveToFirst()) { // get name, email, and comment from USER_ID String[] mainUserId = PgpKeyHelper.splitUserId(data.getString(KEYRING_INDEX_USER_ID)); if (mainUserId[0] != null) { getActivity().setTitle(mainUserId[0]); mName.setText(mainUserId[0]); } else { getActivity().setTitle(R.string.user_id_no_name); mName.setText(R.string.user_id_no_name); }/*ww w. ja v a 2 s .c o m*/ mEmail.setText(mainUserId[1]); mComment.setText(mainUserId[2]); } break; case LOADER_ID_USER_IDS: mUserIdsAdapter.swapCursor(data); break; case LOADER_ID_KEYS: // the first key here is our master key if (data.moveToFirst()) { // get key id from MASTER_KEY_ID long keyId = data.getLong(KEYS_INDEX_KEY_ID); String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId); mKeyId.setText(keyIdStr); // get creation date from CREATION if (data.isNull(KEYS_INDEX_CREATION)) { mCreation.setText(R.string.none); } else { Date creationDate = new Date(data.getLong(KEYS_INDEX_CREATION) * 1000); mCreation.setText( DateFormat.getDateFormat(getActivity().getApplicationContext()).format(creationDate)); } // get expiry date from EXPIRY if (data.isNull(KEYS_INDEX_EXPIRY)) { mExpiry.setText(R.string.none); } else { Date expiryDate = new Date(data.getLong(KEYS_INDEX_EXPIRY) * 1000); mExpiry.setText( DateFormat.getDateFormat(getActivity().getApplicationContext()).format(expiryDate)); } String algorithmStr = PgpKeyHelper.getAlgorithmInfo(data.getInt(KEYS_INDEX_ALGORITHM), data.getInt(KEYS_INDEX_KEY_SIZE)); mAlgorithm.setText(algorithmStr); byte[] fingerprintBlob = data.getBlob(KEYS_INDEX_FINGERPRINT); if (fingerprintBlob == null) { // FALLBACK for old database entries fingerprintBlob = ProviderHelper.getFingerprint(getActivity(), mDataUri); } String fingerprint = PgpKeyHelper.convertFingerprintToHex(fingerprintBlob); mFingerprint.setText(PgpKeyHelper.colorizeFingerprint(fingerprint)); } mKeysAdapter.swapCursor(data); break; default: break; } }
From source file:org.alfresco.mobile.android.application.fragments.workflow.CreateTaskFragment.java
@Override public void onResume() { super.onResume(); if (!DisplayUtils.hasCentralPane(getActivity())) { UIUtils.displayTitle(getActivity(), R.string.task_create); }//from w w w . jav a 2 s.c o m super.onResume(); dueOn = (Button) viewById(R.id.process_due_on); if (dueAt != null) { dueOn.setText(DateFormat.getDateFormat(getActivity()).format(dueAt.getTime())); } }
From source file:org.alfresco.mobile.android.application.fragments.workflow.CreateTaskFragment.java
@Override public void onDatePicked(String dateId, GregorianCalendar gregorianCalendar) { if (getSession() instanceof RepositorySessionImpl && ((RepositorySessionImpl) getSession()).hasPublicAPI()) { gregorianCalendar.set(Calendar.HOUR_OF_DAY, 00); gregorianCalendar.set(Calendar.MINUTE, 00); gregorianCalendar.set(Calendar.SECOND, 00); gregorianCalendar.set(Calendar.MILLISECOND, 000); } else {/* w w w . ja v a 2s .com*/ gregorianCalendar.set(Calendar.HOUR_OF_DAY, 23); gregorianCalendar.set(Calendar.MINUTE, 59); gregorianCalendar.set(Calendar.SECOND, 59); gregorianCalendar.set(Calendar.MILLISECOND, 999); } dueAt = gregorianCalendar; Button dueOn = (Button) viewById(R.id.process_due_on); dueOn.setText(DateFormat.getDateFormat(getActivity()).format(dueAt.getTime())); }
From source file:de.ub0r.android.smsdroid.ConversationListActivity.java
/** * Convert time into formated date./* ww w. ja va 2s. c o m*/ * * @param context * {@link Context} * @param time * time * @return formated date. */ static String getDate(final Context context, final long time) { long t = time; if (t < MIN_DATE) { t *= MILLIS; } if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PreferencesActivity.PREFS_FULL_DATE, false)) { return DateFormat.getTimeFormat(context).format(t) + " " + DateFormat.getDateFormat(context).format(t); } else if (t < CAL_DAYAGO.getTimeInMillis()) { return DateFormat.getDateFormat(context).format(t); } else { return DateFormat.getTimeFormat(context).format(t); } }
From source file:org.tigase.mobile.chat.ChatHistoryFragment.java
private void showMessageDetails(final long id) { Cursor cc = null;/* ww w . j ava 2 s . c o m*/ final java.text.DateFormat df = DateFormat.getDateFormat(getActivity()); final java.text.DateFormat tf = DateFormat.getTimeFormat(getActivity()); try { cc = getChatEntry(id); Dialog alertDialog = new Dialog(getActivity()); alertDialog.setContentView(R.layout.chat_item_details_dialog); alertDialog.setCancelable(true); alertDialog.setCanceledOnTouchOutside(true); alertDialog.setTitle("Message details"); TextView msgDetSender = (TextView) alertDialog.findViewById(R.id.msgDetSender); msgDetSender.setText(cc.getString(cc.getColumnIndex(ChatTableMetaData.FIELD_JID))); Date timestamp = new Date(cc.getLong(cc.getColumnIndex(ChatTableMetaData.FIELD_TIMESTAMP))); TextView msgDetReceived = (TextView) alertDialog.findViewById(R.id.msgDetReceived); msgDetReceived.setText(df.format(timestamp) + " " + tf.format(timestamp)); final int state = cc.getInt(cc.getColumnIndex(ChatTableMetaData.FIELD_STATE)); TextView msgDetState = (TextView) alertDialog.findViewById(R.id.msgDetState); switch (state) { case ChatTableMetaData.STATE_INCOMING: msgDetState.setText("Received"); break; case ChatTableMetaData.STATE_OUT_SENT: msgDetState.setText("Sent"); break; case ChatTableMetaData.STATE_OUT_NOT_SENT: msgDetState.setText("Not sent"); break; default: msgDetState.setText("?"); break; } alertDialog.show(); } finally { if (cc != null && !cc.isClosed()) cc.close(); } }
From source file:org.adblockplus.android.Preferences.java
/** * Constructs and updates subscription status text. * * @param text/*ww w .j a v a2s.c o m*/ * status message * @param time * time of last change */ private void setSubscriptionStatus(final String text, final long time) { final ListPreference subscriptionList = (ListPreference) findPreference( getString(R.string.pref_subscription)); final CharSequence summary = subscriptionList.getEntry(); final StringBuilder builder = new StringBuilder(); if (summary != null) { builder.append(summary); if (StringUtils.isNotEmpty(text)) { builder.append(" ("); final int id = getResources().getIdentifier(text, "string", getPackageName()); if (id > 0) builder.append(getString(id, text)); else builder.append(text); if (time > 0) { builder.append(": "); final Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(time); final Date date = calendar.getTime(); builder.append(DateFormat.getDateFormat(this).format(date)); builder.append(" "); builder.append(DateFormat.getTimeFormat(this).format(date)); } builder.append(")"); } subscriptionSummary = builder.toString(); subscriptionList.setSummary(subscriptionSummary); } }