List of usage examples for android.text.format DateFormat getMediumDateFormat
public static java.text.DateFormat getMediumDateFormat(Context context)
From source file:com.example.crudcontent.fragment.EditCityFragment.java
private void updateDateVisitedView(EditCityFragmentBinding binding) { binding.dateVisited.setText(DateFormat.getMediumDateFormat(getActivity()).format(dateOfVisit)); }
From source file:com.mycelium.wallet.activity.modern.RecordsFragment.java
private void setNameForNewRecord(Record record) { if (record == null || !isAdded()) { return;//from w w w.j av a 2s. com } // Determine a default name from the current date but in such a way that // it does not collide with any name we have already by adding a counter // to the name if necessary String baseName = DateFormat.getMediumDateFormat(this.getActivity()).format(new Date()); String defaultName = baseName; int num = 1; while (_addressBook.getAddressByName(defaultName) != null) { defaultName = baseName + " (" + num++ + ')'; } setLabelOnKey(record.address, defaultName); }
From source file:org.tvbrowser.tvbrowser.TvBrowser.java
private void showAbout() { AlertDialog.Builder builder = new AlertDialog.Builder(TvBrowser.this); RelativeLayout about = (RelativeLayout) getLayoutInflater().inflate(R.layout.about, getParentViewGroup(), false);/* www . j av a 2s .c o m*/ try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); TextView version = (TextView) about.findViewById(R.id.version); version.setText(pInfo.versionName); } catch (NameNotFoundException e) { e.printStackTrace(); } ((TextView) about.findViewById(R.id.license)) .setText(Html.fromHtml(getResources().getString(R.string.license))); TextView androidVersion = (TextView) about.findViewById(R.id.android_version); androidVersion.setText(Build.VERSION.RELEASE); TextView lastUpdate = (TextView) about.findViewById(R.id.data_update); lastUpdate.setText(DateFormat.getLongDateFormat(TvBrowser.this) .format(new Date(PrefUtils.getLongValue(R.string.LAST_DATA_UPDATE, 0)))); TextView nextUpdate = (TextView) about.findViewById(R.id.next_data_update); switch (Integer.parseInt( PrefUtils.getStringValue(R.string.PREF_AUTO_UPDATE_TYPE, R.string.pref_auto_update_type_default))) { case 0: nextUpdate.setText(R.string.next_data_update_manually); break; case 1: nextUpdate.setText(R.string.next_data_update_connection); break; case 2: { Date date = new Date(PrefUtils.getLongValue(R.string.AUTO_UPDATE_CURRENT_START_TIME, 0)); nextUpdate.setText(DateFormat.getMediumDateFormat(TvBrowser.this).format(date) + " " + DateFormat.getTimeFormat(TvBrowser.this).format(date)); } break; } ((TextView) about.findViewById(R.id.rundate_value)) .setText(DateFormat.getLongDateFormat(getApplicationContext()).format(mRundate.getTime())); builder.setTitle(R.string.action_about); builder.setView(about); builder.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); builder.show(); }