forked from D-clock/AndroidStudyCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainActivity.java
More file actions
41 lines (34 loc) · 1.49 KB
/
MainActivity.java
File metadata and controls
41 lines (34 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.clock.study.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.clock.study.R;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.btn_camera_take_photo).setOnClickListener(this);
findViewById(R.id.btn_animation).setOnClickListener(this);
findViewById(R.id.btn_animator).setOnClickListener(this);
findViewById(R.id.btn_day_night).setOnClickListener(this);
}
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.btn_camera_take_photo) {
Intent takePhotoIntent = new Intent(this, CapturePhotoActivity.class);
startActivity(takePhotoIntent);
} else if (viewId == R.id.btn_animation) {
Intent animationIntent = new Intent(this, AnimationActivity.class);
startActivity(animationIntent);
} else if (viewId == R.id.btn_animator) {
Intent animatorIntent = new Intent(this, AnimatorActivity.class);
startActivity(animatorIntent);
} else if (viewId == R.id.btn_day_night) {
Intent animatorIntent = new Intent(this, DayNightActivity.class);
startActivity(animatorIntent);
}
}
}