summaryrefslogtreecommitdiffstats
path: root/Android/03-Permissions/PermissionsLab/src/course/labs/permissionslab/GoToDangerousActivity.java
blob: 171f469e661c7ad36e389f5480e08e754dac1919 (plain)
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
package course.labs.permissionslab;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class GoToDangerousActivity extends Activity {

    private static final String TAG = "Lab-Permissions";

    private static final String DANGEROUS_ACTIVITY_ACTION = "course.labs.dangerousapp.DANGEROUS_ACTIVITY";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.go_to_dangerous_activity);

        Button startDangerousActivityButton = (Button) findViewById(R.id.start_dangerous_activity_button);
        startDangerousActivityButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                startDangerousActivity();
            }
        });
    }

    private void startDangerousActivity() {
        Log.i(TAG, "Entered startDangerousActivity()");
        startActivity(new Intent(DANGEROUS_ACTIVITY_ACTION));
    }
}