0

I am developing an app for a event in my university. So i need a countdown timer for that. Google IO android app had a better countdown timer. The Google IO app in available in GitHub. But in kotlin. https://github.com/google/iosched

I tried finding the components for the countdown timer in the GitHub project. But was not successfully. Can any one guide me to implement this countdown timer. Thanks

XperiBlog
  • 44
  • 4
  • 1
    I don't understand properly what you are looking actually. Currently I am developing an android app using Java. Where I already implemented CountDownTimer. Is it enough to give you this code ? – Suman Kumar Dash Sep 24 '19 at 03:56
  • `guide me` this is wrong place to ask for guide. You can either continue investigating that code, or (better) just start it from scratch on your own. If you have some specific problem - ask a specific question – Vladyslav Matviienko Sep 24 '19 at 04:35
  • @suman Dash ok. Can you give me it. – XperiBlog Sep 24 '19 at 08:32
  • I need something like this https://play.google.com/store/apps/details?id=org.beatonma.io16&hl=en – XperiBlog Sep 24 '19 at 08:33
  • Clone and run the iosched project using Android Studio. The CountdownView is https://github.com/google/iosched/blob/master/mobile/src/main/java/com/google/samples/apps/iosched/widget/CountdownView.kt – no_name Oct 07 '19 at 11:11

1 Answers1

0
 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.example.countdowntimer.MainActivity">

<Button
    android:text="@string/start_timer"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="158dp"
    android:id="@+id/button"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textStyle="bold|italic" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/button"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="63dp"
    android:id="@+id/textView"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="40sp" />

after that

 import android.os.CountDownTimer;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.TextView;

 public class MainActivity extends AppCompatActivity  {
public int counter;
Button button;
TextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    button= (Button) findViewById(R.id.button);
    textView= (TextView) findViewById(R.id.textView);
    button.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v) {
            new CountDownTimer(30000, 1000){
                public void onTick(long millisUntilFinished){
                    textView.setText(String.valueOf(counter));
                    counter++;
                }
                public  void onFinish(){
                   textView.setText("FINISH!!");
                }
            }.start();
        }
    });
}

}

Suman Kumar Dash
  • 681
  • 5
  • 19