3.17. DetailActivity2.Java
package
com.example.rambulalulintas;
import
android.app.Activity;
import
android.app.AlertDialog;
import
android.content.DialogInterface;
import
android.os.Bundle;
import
android.view.View;
import
android.widget.Button;
import
android.widget.ImageView;
import
android.widget.TextView;
public class
DetailActivity2
extends
Activity { String
title ;
String description
; String
dialoginformation ;
int
image ;
Override
public void
onCreateBundle savedInstanceState {
super
.onCreatesavedInstanceState; setContentViewR.layout.
detail2 ;
TextView tvTitleLabel = TextViewfindViewByIdR.id. tvTitleLabel
; TextView tvDescLabel = TextViewfindViewByIdR.id.
tvDescLabel ;
ImageView ivPrImage = ImageViewfindViewByIdR.id. ivPrvImage
; Button btn = ButtonfindViewByIdR.id.
button1 ;
Bundle extras = getIntent.getExtras;
if
extras =
null
{ title
= extras.getString namarambu
; tvTitleLabel.setText
title ;
btn.setText Nomor rambu
+ title
; dialoginformation
= extras.getString dialogmsg
; image
= extras.getInt prvImg
; ivPrImage.setImageResource
image ;
description = extras.getString
rambudesclabel ;
tvDescLabel.setText description
} btn.setOnClickListener
new
View.OnClickListener { Override
public void
onClickView v { AlertDialog.Builder dlgAlert =
new
AlertDialog.BuilderDetailActivity2.
this
; dlgAlert.setMessage
dialoginformation ;
dlgAlert.setTitle title
; dlgAlert.setNegativeButton
ok ,
null
; dlgAlert.create.show;
} };
}
public void
tombolpelanggaran View view {
AlertDialog.Builder builder =
new
AlertDialog.Builder
this
; builder.setTitle
Apabila melanggar ;
builder.setMessage Sesuai undang-undang No.22 Tahun 2009 tentang lalu lintas dan
anggkutan jalan\n\n +
Pelaku : Setiap Pengemudi pengemudi semua jenis kendaraan bermotor\n\n
+ Pasal yang dilanggar : Pasal 287 ayat1 jo Pasal
106 ayat4 huruf a dan pasal 106 ayat 4 huruf c\n\n +
Bentuk Pelanggaran : Melanggar aturan perintah atau larangan yang dinyatakan dengan Rambu Lalu Lintas dan Marka\n\n
+ Sanksi : pidana kurungan paling lama dua 2
bulan atau denda paling banyak Rp.500.000,- .setNegativeButton
OK ,
new
DialogInterface.OnClickListener {
public void
onClickDialogInterface dialog,
int
id { dialog.cancel;
} }.show;
};
}
3.18. Dasar_hukum.java
package
com.example.rambulalulintas;
import
android.os.Bundle;
import
android.app.Activity;
import
android.content.Intent;
import
android.view.Menu;
import
android.view.View;
public class
Dasar_hukum
extends
Activity { Override
protected void
onCreateBundle savedInstanceState {
super
.onCreatesavedInstanceState; setContentViewR.layout.
activity_dasar_hukum ;
}
public void
kembaliView view { Intent intent =
new
Intent
this
, Menu_utama.
class
; startActivityintent;
finish;} Override
public void
onBackPressed {
TODO
Auto-generated method stub super.onBackPressed;
startActivity
new
Intent
this
, Menu_utama.
class
; }
Override
public boolean
onCreateOptionsMenuMenu menu { Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater.inflateR.menu. dasar_hukum
, menu;
return true
; }
}