-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathopenpic.java
More file actions
36 lines (31 loc) · 1.07 KB
/
openpic.java
File metadata and controls
36 lines (31 loc) · 1.07 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
package com.fiona.personalcodingproject;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class OpenPic extends Activity {
// reference button
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// connect to starting XML file
setContentView(R.layout.starting);
addListenerOnButton();
}
public void addListenerOnButton() {
final Context context = this;
// connect to imagebutton id from the starting XML file
button = (Button)findViewById(R.id.imagebutton);
button.setOnClickListener(new View.OnClickListener() {
@Override
// connect openpic class to the pic class (pic class activated after openpic class)
public void onClick(View v) {
Intent intent = new Intent(context, pic.class);
startActivity(intent);
}
});
}
}