0% found this document useful (0 votes)
4 views1 page

Android Activity Button Navigation Code

This document defines a class called HalamanSatu that extends the Activity class. It overrides methods like onCreate() to set the content view to halaman_satu.xml. It finds a button with id R.id.buttonKeHalDua and sets a click listener to start a new activity called HalamanDua when clicked. It also overrides menu-related methods to handle the options menu.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Android Activity Button Navigation Code

This document defines a class called HalamanSatu that extends the Activity class. It overrides methods like onCreate() to set the content view to halaman_satu.xml. It finds a button with id R.id.buttonKeHalDua and sets a click listener to start a new activity called HalamanDua when clicked. It also overrides menu-related methods to handle the options menu.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1 package [Link].

intent;
2
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7 import [Link];
8 import [Link];
9 import [Link];
10
11
12 public class HalamanSatu extends Activity {
13
14 @Override
15 protected void onCreate(Bundle savedInstanceState) {
16 [Link](savedInstanceState);
17 setContentView([Link].halaman_satu);
18
19 Button tombolKeHal2 = (Button) findViewById([Link]);
20 [Link](new [Link]() {
21
22 @Override
23 public void onClick(View arg0) {
24 // TODO Auto-generated method stub
25 Intent intent = new Intent([Link](),
26 [Link]);
27 startActivity(intent);
28 }
29 });
30
31 }
32
33 @Override
34 public boolean onCreateOptionsMenu(Menu menu) {
35 // Inflate the menu; this adds items to the action bar if it is present.
36 getMenuInflater().inflate([Link].halaman_satu, menu);
37 return true;
38 }
39
40 @Override
41 public boolean onOptionsItemSelected(MenuItem item) {
42 // Handle action bar item clicks here. The action bar will
43 // automatically handle clicks on the Home/Up button, so long
44 // as you specify a parent activity in [Link].
45 int id = [Link]();
46 if (id == [Link].action_settings) {
47 return true;
48 }
49 return [Link](item);
50 }
51 }
52

You might also like