Saturday, 19 August 2017

Create Time Picker


public class TimePickerActivity extends AppCompatActivity {

    TimePicker timePicker;
    Button button;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_time_picker);

        timePicker=(TimePicker)findViewById(R.id.timePicker);

        button=(Button)findViewById(R.id.button4);

     button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String currtTime=timePicker.getCurrentHour()+"--"+timePicker.getCurrentMinute();
                Toast.makeText(getApplicationContext(),currtTime,Toast.LENGTH_SHORT).show();

            }
        });



    }
}

No comments:

Post a Comment

HOW TO CREATE CIRCLE IMAGE VIEW

Step 1: implementation 'de.hdodenhof:circleimageview:3.0.0' Step 2: <de.hdodenhof.circleimageview.CircleImageView xmlns:ap...