How can I show the clock hours and seconds in the textview continuously as I am using dynamic linear layout? This format works on static layout, but thanks to me on the dynamic layout thank you?
-
list item
expand the public class ButtonActivity Activity (Button; Scrollview ScrollView; Int calculation = 4; 'Enter the code here' Int mHOR, mminute, msccnd; int min, hr, second; personal handler mHandler = new handler (); crate on public void (bundle saved instanestate) {super.Nocrat (savedinstenstate); setContentView (R.layout.activity_button ); Runnabel mUpdate = new Runnabal () {@ Override Public Wide Run) Lender c = Calendar.getInstance (); MHour = c.get (calendar.HOUR_OF_DAY); mminute = c. Gate (calendar.mind.te); msecond = c.get (calendar. SECOND); min = mMinute; bell = amhaur; Sec = mSecond; String timeset = "" if (HR> 12) {HR - = 12; time = "PM";} and if (HR == 0) {HR + = 12; timeset = "AM" ;); Else if (hr == 12) timeSet = "PM"; and timeset = "AM"; string min = ""; if (minimum <10) min = "0" + minute; and minute = string Valueoff (minute); string second = ""; if (sec <10) seconds = "0" + seconds; Else secs = String.valueOf (sec); MHandler.postDelayed (this, 1000); }}; MHandler.post (mUpdate); Scrollview = New ScrollView (this); LinearLayout linearlayout = New linerlight (this); Linearlayout.setOrientation (LinearLayout.VERTICAL); Scrollview.addView (LinearLayout); TextView T = new text view (this); T.setText (HR + ":" + minute + ":" + second + "" + timeout); Linearlayout.addView (t); For (int i = 0; i
}}
You must call setText () on your Runnable run () method in your TextView inside The way this text is now, it will be set only when the activity is created.
No comments:
Post a Comment