Hi all
I want to store a value from text view and , the text view show the value and it well change , and I well use if condition with some events , if the event equals for example 0 set the value you store it , for example the value I store it from text view is 10,5 , use if condition and when the condition equals for example zero the text view displayed 10,5 . I hope my problem is clear and I hope someone can help me
thanks for all
finally I was stored the values in set method and get it also , it's work if the time is 00:00:00 it is show me the time I store it in a massage , now I want to display the time in the massage to text view to return countdown again , it's the last step and the countdown timer with timer picker well work successfully .
Answers
@omar.7226 can you post your code snipes what you tried so far?
@PubuduGayan
first I'm working with time picker and timer together and I want to store the time I selected and start timer , when the time equals 00:00:00 I want to set the time I selected before etc..
here my code
Main Activity.cs ;-
Timer _timer; int _countsecond = 1; TextView textview; int seconds = 59; int minutes; int hours; string _t; Button _btnpick; Button _start;
`textview = FindViewById(Resource.Id.tvTimeCount);
_btnpick = FindViewById(Resource.Id.pickTime);
_start = FindViewById(Resource.Id.startcount);
_start.Click += delegate
{
_timer = new Timer();
_timer.Interval = 1000;
_timer.Elapsed += _timer_Elapsed;
_timer.Enabled = true;
_timer.Start();
};
_btnpick.Click += delegate
{
TimePickerDialog _tp = new TimePickerDialog(this, TimePickerCallback, hours, minutes, true);
_tp.Show();
};
private void _timer_Elapsed(object sender, ElapsedEventArgs e) { CountDownTimer(); }
private void UpdateTime() { _t = string.Format("{0}:{1}:{2}", hours, minutes, seconds.ToString().PadLeft(2, '0')); textview.Text = _t; }
` private void TimePickerCallback(object sender, TimePickerDialog.TimeSetEventArgs e)
{
hours = e.HourOfDay;
minutes = e.Minute;
UpdateTime();
`private void CountDownTimer()
{
if (seconds != 0)
{
RunOnUiThread(() => {seconds--;
`
i'm sorry in CountDownTimer() the last condition I put textview1.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
{
textview.Text = e.Text.ToString();
};
it just was try to copy the textview in another textview but field and I removed
finally I was stored the values in set method and get it also , it's work if the time is 00:00:00 it is show me the time I store it in a massage , now I want to display the time in the massage to text view to return countdown again , it's the last step and the countdown timer with timer picker well work successfully .