Issue
I want use TextClock in my Android application which display user history. Currently I was using TextView for display time but for better support TimeZone and Hour Format, I am thinking to use TextClock.
I have implemented it like below in XML
<TextClock
android:id="@+id/txt_start_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.25"
android:drawableStart="@drawable/ic_calendar_small"
android:gravity="center_vertical|start"
android:format12Hour="dd/MM/yyyy hh:mm a"
android:format24Hour="dd/MM/yyyy kk:mm"
android:timeZone="Asia/Calcutta"
android:text="15 jul, 2018 10:12:11"
android:textColor="@color/grey_90"
android:textSize="10sp" />
But I am not able to set My Time Which I am getting From Server. I was setting it in TextView like below
holder.txtStartTime.setText(AppUtils.getSimpleStringDate(mData.get(pPosition).getStartTime(),
"yyyy-MM-dd HH:mm:ss","dd MMM, yyyy HH:mm:ss") );
Instead Now I want use TextClock. How can I set time in TextClock ?
Thanks
Solution
You can't use TextClock to set different time and show.
TextClock can display the current date and/or time as a formatted string.
you can check doc.
You'll have to use TextView only.
Answered By - Man