Anda di halaman 1dari 26

56

MATERI 6
APLIKASI MOBILE UNTUK PENDAFTARAN AKTA KELAHIRAN
(M-AKTA)

Imajinasikan anda menjadi programmer untuk aplikasi itu anda ditugaskan untuk membuat
tampilan user interface untuk aplikasi mobile pendaftaran kelahiran/akta kelahiran tersebut..
Yang harus anda desain adalah FORM LOGIN, FORM PENDAFTARAN USER PEMAKAI
APLIKASI, FORM MENU LAYANAN, FORM PENDAFTARAN KELAHIRAN (4 BUAH
TAMPILAN.)
1. Form Loginbuat menurut anda yang mantaps lah.
2. form pendaftaran user. berisi (Nomor KTP, Nama, T.T.L, Alamat,Jenis Kelamin, Agama,
Pekerjaan, Username, Password)
3. form pendaftaran kelahiran yang berisi formulir seperti berikut :
Nama :
Tempat/tgl lahir :
Jam :
Jenis Kelamin :
Anak yang ke :
Adalah benar anak kandung dari :
Ayah : Nama :
Umur :
Pekerjaan :
Alamat :
Ibu : Nama :
Umur :
Pekerjaan :
Alamat :
PENYELESAIAN
57

tampilan layout login

code xml diatas adalah seperti berikut
login.xml
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
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/widg37"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<TableLayout
android:id="@+id/widget37"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<TableRow
android:id="@+id/widget45"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget47"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username :" />

<EditText
android:id="@+id/txtusername"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />

</TableRow>
58

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<TableRow
android:id="@+id/widget46"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget55"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password :" />
<EditText
android:id="@+id/txtpassword"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text=""
android:password="True"
android:textSize="18sp" />
</TableRow>
</TableLayout>

<TableLayout
android:id="@+id/w7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<TableRow
android:id="@+id/widget65"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnlogin"
android:onClick="login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="L O G I N" />
<Button
android:id="@+id/btndaftar"
android:onClick="daftar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DAFTAR" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/txtstatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>

59

TAMPILAN LAYOUT REGISTER USER
berikut adalah tampilan desain register user yg akan menggunakan aplikasi.

coding xml tampilan diatas adalah sebagai berikut :
daftar_user.xml
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
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/widget124"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<LinearLayout
android:id="@+id/widget124"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<TableLayout
android:id="@+id/widget125"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableRow
android:id="@+id/widget126"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
60

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
android:id="@+id/widget127"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nomor KTP" />
<EditText
android:id="@+id/txtnomorktp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>

<TableRow
android:id="@+id/widget129"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget130"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nama" />


<EditText
android:id="@+id/txtnama"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />

</TableRow>
<TableRow
android:id="@+id/widget132"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget133"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="T.T.L" />
<EditText
android:id="@+id/txtttl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget135"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget136"
android:layout_width="wrap_content"
61

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
android:layout_height="wrap_content"
android:text="Alamat" />
<EditText
android:id="@+id/txtalamat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget138"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget139"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jenis Kelamin " />
<RadioGroup
android:id="@+id/jekel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/pria"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pria" />

<RadioButton
android:id="@+id/perempuan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Perempuan" />
</RadioGroup>

</TableRow>
<TableRow
android:id="@+id/widget143"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget144"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Agama" />
<EditText
android:id="@+id/txtagama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget146"
62

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget147"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pekerjaan" />
<EditText
android:id="@+id/txtpekerjaan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget149"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget150"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Username" />
<EditText
android:id="@+id/txtusername"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget152"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget153"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password" />
<EditText
android:id="@+id/txtpassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:password="True"
android:textSize="18sp" />
</TableRow>
</TableLayout>

<TableLayout
android:id="@+id/widget125"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
63

197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<TableRow
android:id="@+id/widget155"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnsimpan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIMPAN" />
<Button
android:id="@+id/btnexit"
android:onClick="keluar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E X I T" />
</TableRow>

</TableLayout>
<TextView
android:id="@+id/txtstatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
</ScrollView>
64

TAMPILAN REGISTER AKTA (DAFTAR AKTA)
berikut ini adalah tampilan form pendaftaran akta kelahiran.

coding xml untuk tampilan diatas adalah sebagai berikut :
daftar_akta.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/widget124"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<LinearLayout
android:id="@+id/widget124"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<TableLayout
android:id="@+id/widget125"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableRow
65

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
android:id="@+id/widget126"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget127"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nomor Register" />
<EditText
android:id="@+id/txtnomor_reg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>

<TableRow
android:id="@+id/widget129"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget130"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nama" />


<EditText
android:id="@+id/txtnama"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />

</TableRow>
<TableRow
android:id="@+id/widget132"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
</TableRow>
<TableRow
android:id="@+id/widget135"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget136"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="T.T.L" />
<EditText
android:id="@+id/txtttl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
66

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/w"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget136"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jam" />
<EditText
android:id="@+id/txtjam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget138"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget139"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jenis Kelamin " />
<RadioGroup
android:id="@+id/jekel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/pria"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pria" />

<RadioButton
android:id="@+id/perempuan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Perempuan" />
</RadioGroup>

</TableRow>
<TableRow
android:id="@+id/widget143"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget144"
android:layout_width="wrap_content"
67

135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
android:layout_height="wrap_content"
android:text="Anak yang Ke-" />
<EditText
android:id="@+id/txtanak_ke"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/wiet146"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget147"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adalah benar anak " />
<TextView
android:id="@+id/widget147"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Kandung dari " />
</TableRow>
<TableRow
android:id="@+id/wit146"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget1473"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AYAH" />
</TableRow>
<TableRow
android:id="@+id/widget149"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget150"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nama" />
<EditText
android:id="@+id/txtayah_nama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget152"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
68

192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
android:orientation="horizontal">
<TextView
android:id="@+id/widget153"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Umur" />
<EditText
android:id="@+id/txtayah_umur"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget343"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget450"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pekerjaan" />
<EditText
android:id="@+id/txtayah_pekerjaan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget943"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget950"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Alamat" />
<EditText
android:id="@+id/txtayah_alamat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/wit146"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget1373"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="IBU KANDUNG" />
69

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
</TableRow>
<TableRow
android:id="@+id/widget139"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget130"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nama" />
<EditText
android:id="@+id/txtibu_nama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget1352"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget1353"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Umur" />
<EditText
android:id="@+id/txtibu_umur"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget11343"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/widget13450"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pekerjaan" />
<EditText
android:id="@+id/txtibu_pekerjaan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
<TableRow
android:id="@+id/widget13943"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
70

306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<TextView
android:id="@+id/widget950"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Alamat" />
<EditText
android:id="@+id/txtibu_alamat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp" />
</TableRow>
</TableLayout>

<TableLayout
android:id="@+id/widget125"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TableRow
android:id="@+id/widget155"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnsimpan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIMPAN" />
<Button
android:id="@+id/btnexit"
android:onClick="keluar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="E X I T" />
</TableRow>

</TableLayout>
<TextView
android:id="@+id/txtstatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</LinearLayout>
</ScrollView>
DATABASE MY SQL nya
kita membutuhkan dua buah tabel yaitu tabel user dan tabel untuk daftar akta..
berikut code by sql yoq backup databasenya.
1
2
3
4
5
6
/*
SQLyog Enterprise - MySQL GUI v8.2 RC2
MySQL - 5.5.8 : Database - akta
*********************************************************************
*/

71

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS,
FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`akta` /*!40100 DEFAULT CHARACTER
SET latin1 */;

USE `akta`;

/*Table structure for table `daftar_akta` */

DROP TABLE IF EXISTS `daftar_akta`;

CREATE TABLE `daftar_akta` (
`nomor_reg` varchar(12) NOT NULL,
`nama` varchar(30) DEFAULT NULL,
`ttl` varchar(50) DEFAULT NULL,
`jam` varchar(5) DEFAULT NULL,
`jekel` varchar(9) DEFAULT NULL,
`anak_ke` int(11) DEFAULT NULL,
`ayah_nama` varchar(30) DEFAULT NULL,
`ayah_umur` int(11) DEFAULT NULL,
`ayah_pekerjaan` varchar(30) DEFAULT NULL,
`ayah_alamat` varchar(50) DEFAULT NULL,
`ibu_nama` varchar(30) DEFAULT NULL,
`ibu_umur` int(11) DEFAULT NULL,
`ibu_pekerjaan` varchar(50) DEFAULT NULL,
`ibu_alamat` varchar(50) DEFAULT NULL,
PRIMARY KEY (`nomor_reg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;




/*Table structure for table `user` */

DROP TABLE IF EXISTS `user`;

CREATE TABLE `user` (
`nomor_ktp` float NOT NULL,
`nama` varchar(30) DEFAULT NULL,
`ttl` varchar(100) DEFAULT NULL,
`alamat` varchar(100) DEFAULT NULL,
`jekel` varchar(10) DEFAULT NULL,
`agama` varchar(15) DEFAULT NULL,
`pekerjaan` varchar(20) DEFAULT NULL,
`username` varchar(25) DEFAULT NULL,
`password` varchar(25) DEFAULT NULL,
PRIMARY KEY (`nomor_ktp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

72

64
65
66
67


/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
KITA MEMBUTUHKAN 5 FILE JAVA
login.java
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
42
43
44
45
package com.wilis;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class login extends Activity {
/** Called when the activity is first created. */
EditText username,password;
TextView status;
Button login,daftar;


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);

username=(EditText) findViewById(R.id.txtusername);
password=(EditText) findViewById(R.id.txtpassword);
status=(TextView) findViewById (R.id.txtstatus);

login=(Button) findViewById (R.id.btnlogin);
daftar=(Button) findViewById (R.id.btndaftar);

login.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

ArrayList<NameValuePair> postParameters = new
ArrayList<NameValuePair>();
73

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

postParameters.add(new BasicNameValuePair("username",
username.getText().toString()));

postParameters.add(new BasicNameValuePair("password",
password.getText().toString()));

/* String valid = "1";*/

String response = null;

try {

response =
CustomHttpClient.executeHttpPost("http://10.0.2.2/akta/check.php",
postParameters);

String res = response.toString();

res = res.trim();

res = res.replaceAll("\\s+","");

status.setText(res);

if (res.equals("1"))
{
status.setText("Correct Username or Password");
berhasil(v);

}
else {
status.setText("Sorry!! Wrong Username or Password
Entered");

}
}

catch (Exception e) {

status.setText(e.toString());

}

}

});

// penutup buka dari public void onCreate
}




public void daftar (View theButton)
{
Intent d = new Intent (this,daftar_user.class);
74

103
104
105
106
107
108
109
startActivity(d);
}


// apabila user berhasil login.

public void berhasil (View theButton)
{
Intent s = new Intent (this, menulayanan.class);
startActivity(s);
}

}
file check.php yang digunakan adalah seperti berikut :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

$username=$_POST['username'];
$password=$_POST['password'];

$conn = mysql_connect("localhost","root","");
mysql_select_db("akta");

$query = "SELECT * FROM user WHERE username = '$username' AND password
='$password'";
$result = mysql_query($query) or die("Unable to verify user because : " .
mysql_error());


if (mysql_num_rows($result) == 1){
echo 1;
}
else {
// print status message
echo 0;
}
?>
FILE JAVA DAFTAR USER
daftar_user.java
1
2
3
4
5
6
7
8
9
10
11
12
13
package com.wilis;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
75

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import android.widget.RadioGroup;
import android.widget.TextView;

public class daftar_user extends Activity {

EditText ktp,nama,ttl,alamat,agama,pekerjaan,username,password;
RadioGroup jk;
TextView status;
Button simpan;


/** Called when the activity is first created. */

@Override


public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.daftar_user);


ktp=(EditText)findViewById(R.id.txtnomorktp);
nama=(EditText)findViewById(R.id.txtnama);
ttl=(EditText)findViewById(R.id.txtttl);
jk=(RadioGroup) findViewById(R.id.jekel);
alamat=(EditText)findViewById(R.id.txtalamat);
agama=(EditText)findViewById(R.id.txtagama);
pekerjaan=(EditText)findViewById(R.id.txtpekerjaan);
username=(EditText)findViewById(R.id.txtusername);
password=(EditText)findViewById(R.id.txtpassword);


simpan=(Button)findViewById(R.id.btnsimpan);
// keluar=(Button)findViewById(R.id.btnexit);
status=(TextView)findViewById(R.id.txtstatus);

simpan.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

//atur variabel utk menampung pilihan jenis kelamin
String type=null;
switch (jk.getCheckedRadioButtonId()) {
case R.id.pria:
type="Pria";
break;
case R.id.perempuan:
type="Perempuan";
break;
}


ArrayList<NameValuePair> postParameters = new
76

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("nomor_ktp",
ktp.getText().toString()));
postParameters.add(new BasicNameValuePair("nama",
nama.getText().toString()));
postParameters.add(new
BasicNameValuePair("ttl",ttl.getText().toString()));
postParameters.add(new BasicNameValuePair("alamat",
alamat.getText().toString()));
postParameters.add(new BasicNameValuePair("jekel", type));
postParameters.add(new BasicNameValuePair("agama",
agama.getText().toString()));
postParameters.add(new BasicNameValuePair("pekerjaan",
pekerjaan.getText().toString()));
postParameters.add(new BasicNameValuePair("username",
username.getText().toString()));
postParameters.add(new BasicNameValuePair("password",
password.getText().toString()));

/* String valid = "1";*/

String response = null;

try {

response =
CustomHttpClient.executeHttpPost("http://10.0.2.2/akta/daftar_user.php",
postParameters);

String res = response.toString();

res = res.trim();

res = res.replaceAll("\\s+","");

status.setText(res);

if (res.equals("1")) status.setText("Data tidak Tersimpan
Ke server");

else status.setText("Data berhasil disimpan ke server");

}

catch (Exception e) {

username.setText(e.toString());

}

}


});
}

public void keluar (View theButton)
77

{
Intent a = new Intent (this,login.class);
startActivity(a);
}
}
daftar_user.php
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
<?php
$nomor_ktp=$_POST['nomor_ktp'];
$nama=$_POST['nama'];
$ttl=$_POST['ttl'];
$alamat=$_POST['alamat'];
$jekel=$_POST['jekel'];
$agama=$_POST['agama'];
$pekerjaan=$_POST['pekerjaan'];
$username=$_POST['username'];
$password=$_POST['password'];


$conn = mysql_connect("localhost","root","");
mysql_select_db("akta");

$query = "INSERT INTO user
(nomor_ktp,nama,ttl,alamat,jekel,agama,pekerjaan,username,password) values
('$nomor_ktp','$nama','$ttl','$alamat','$jekel','$agama','$pekerjaan','$us
ername','$password')";
$result = mysql_query($query) or die("REPORT...Gagal Query Simpan
Data.");

if (mysql_num_rows($result) == 1){
echo 1;
}
else {
// print status message
echo 0;
}

?>
FILE JAVA UNTUK PENDAFTARAN AKTA KELAHIRAN
daftar_akta.java
1
2
3
4
5
6
7
8
9
10
11
12
package com.wilis;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
78

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

public class daftar_akta extends Activity {

EditText
nomor_reg,nama,ttl,jam,anak_ke,ayah_nama,ayah_umur,ayah_pekerjaan,ayah_ala
mat,ibu_nama,ibu_umur,ibu_pekerjaan,ibu_alamat;
RadioGroup jk;
TextView status;
Button simpan,keluar;

/** Called when the activity is first created. */
@Override

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.daftar_akta);

nomor_reg = (EditText)findViewById(R.id.txtnomor_reg);
nama=(EditText)findViewById(R.id.txtnama);
ttl=(EditText)findViewById(R.id.txtttl);
jam=(EditText)findViewById(R.id.txtjam);
jk=(RadioGroup) findViewById(R.id.jekel);
anak_ke = (EditText) findViewById (R.id.txtanak_ke);
ayah_nama = (EditText)findViewById(R.id.txtayah_nama);
ayah_umur = (EditText)findViewById(R.id.txtayah_umur);
ayah_pekerjaan = (EditText)findViewById(R.id.txtayah_pekerjaan);
ayah_alamat = (EditText)findViewById(R.id.txtayah_alamat);
ibu_nama = (EditText)findViewById(R.id.txtibu_nama);
ibu_umur = (EditText)findViewById(R.id.txtibu_umur);
ibu_pekerjaan = (EditText)findViewById(R.id.txtibu_pekerjaan);
ibu_alamat = (EditText)findViewById(R.id.txtibu_alamat);


simpan=(Button)findViewById(R.id.btnsimpan);
keluar=(Button)findViewById(R.id.btnexit);
status=(TextView)findViewById(R.id.txtstatus);

simpan.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

//atur variabel utk menampung pilihan jenis kelamin
String type=null;
switch (jk.getCheckedRadioButtonId()) {
case R.id.pria:
type="Pria";
break;
case R.id.perempuan:
type="Perempuan";
break;
79

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
}


ArrayList<NameValuePair> postParameters = new
ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("nomor_reg",
nomor_reg.getText().toString()));
postParameters.add(new BasicNameValuePair("nama",
nama.getText().toString()));
postParameters.add(new
BasicNameValuePair("ttl",ttl.getText().toString()));
postParameters.add(new
BasicNameValuePair("jam",ttl.getText().toString()));
postParameters.add(new BasicNameValuePair("jekel", type));
postParameters.add(new BasicNameValuePair("anak_ke",
anak_ke.getText().toString()));
postParameters.add(new BasicNameValuePair("ayah_nama",
ayah_nama.getText().toString()));
postParameters.add(new BasicNameValuePair("ayah_umur",
ayah_umur.getText().toString()));
postParameters.add(new BasicNameValuePair("ayah_pekerjaan",
ayah_pekerjaan.getText().toString()));
postParameters.add(new BasicNameValuePair("ayah_alamat",
ayah_alamat.getText().toString()));
postParameters.add(new BasicNameValuePair("ibu_nama",
ibu_nama.getText().toString()));
postParameters.add(new BasicNameValuePair("ibu_umur",
ibu_umur.getText().toString()));
postParameters.add(new BasicNameValuePair("ibu_pekerjaan",
ibu_pekerjaan.getText().toString()));
postParameters.add(new BasicNameValuePair("ibu_alamat",
ibu_alamat.getText().toString()));

/* String valid = "1";*/

String response = null;

try {

response =
CustomHttpClient.executeHttpPost("http://10.0.2.2/akta/daftar_akta.php",
postParameters);

String res = response.toString();

res = res.trim();

res = res.replaceAll("\\s+","");

status.setText(res);

if (res.equals("1")) status.setText("Data tidak Tersimpan
Ke server");

else status.setText("Data berhasil disimpan ke server");

}
80


catch (Exception e) {

nomor_reg.setText(e.toString());

}

}


});
}

public void keluar (View theButton)
{
Intent a = new Intent (this,menulayanan.class);
startActivity(a);
}
}
daftar_akta.php
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
<?php
$nomor_reg=$_POST['nomor_reg'];
$nama=$_POST['nama'];
$ttl=$_POST['ttl'];
$jam=$_POST['jam'];
$jekel=$_POST['jekel'];
$anak_ke=$_POST['anak_ke'];
$ayah_nama=$_POST['ayah_nama'];
$ayah_umur=$_POST['ayah_umur'];
$ayah_pekerjaan=$_POST['ayah_pekerjaan'];
$ayah_alamat=$_POST['ayah_alamat'];
$ibu_nama=$_POST['ibu_nama'];
$ibu_umur=$_POST['ibu_umur'];
$ibu_pekerjaan=$_POST['ibu_pekerjaan'];
$ibu_alamat=$_POST['ibu_alamat'];

$conn = mysql_connect("localhost","root","");
mysql_select_db("akta");

$query = "INSERT INTO daftar_akta
(nomor_reg,nama,ttl,jam,jekel,anak_ke,ayah_nama,ayah_umur,ayah_pekerjaan,a
yah_alamat,ibu_nama,ibu_umur,ibu_pekerjaan,ibu_alamat) values
('$nomor_reg','$nama','$ttl','$jam','$jekel','$anak_ke','$ayah_nama','$aya
h_umur','$ayah_pekerjaan','$ayah_alamat','$ibu_nama','$ibu_umur','$ibu_pek
erjaan','$ibu_alamat')";
$result = mysql_query($query) or die("REPORT...Gagal Query Simpan
Data.");

if (mysql_num_rows($result) == 1){
echo 1;
}
else {
// print status message
echo 0;
81

}

?>
dan berikut adalah code lengkap android manifestnya.
AndroidManifest.xml
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
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wilis"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" />

<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".login" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity android:label="Tambah user pengguna"
android:name=".daftar_user" >
</activity>
<activity android:label="Menu Layanan"
android:name=".menulayanan" >
</activity>
<activity android:label="Daftar Akta Kelahiran"
android:name=".daftar_akta" >
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
penggunaan 10.0.2.2 adalah sistem localhost,,tentunya kalau anda mau gunakan running
langsung di device pastikan ipnya menjadi ip server mysql dan phpnya berada..tinggal ganti ip
10.0.2.2 dengan ip server (mysql&php) jika diakses dengan wifi atau dengan nama domain jika
sudah online.

PUSTAKA:
http://nsafaat.wordpress.com/2012/10/26/aplikasi-mobile-untuk-pendaftaran-akta-kelahiran-m-
akta/ (diakses 15 Februari 2014)

Anda mungkin juga menyukai