<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical"
android:padding="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="View Data : "
android:textAppearance="@style/TextAppearance.AppCompat.Title" />
<TextView
android:id="@+id/tv_nama_barang"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="Barang"
android:inputType="text" />
<TextView
android:id="@+id/tv_merk_barang"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="Merk"
android:inputType="text" />
<TextView
android:id="@+id/tv_harga_barang"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:ems="10"
android:hint="Harga"
android:inputType="number" />
<Button
android:id="@+id/bt_ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="OK" />
</LinearLayout>
public class DetailActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
TextView tvNama = (TextView) findViewById(R.id.tv_nama_barang);
TextView tvMerk = (TextView) findViewById(R.id.tv_merk_barang);
TextView tvHarga = (TextView) findViewById(R.id.tv_harga_barang);
System.out.println("APPINVENT " + getIntent().getExtras().getString("nama"));
tvNama.setText("Barang " + getIntent().getExtras().getString("nama"));
tvMerk.setText("Merk " + getIntent().getExtras().getString("merk"));
tvHarga.setText("Harga " + getIntent().getExtras().getString("harga"));
Button buttonOK = (Button) findViewById(R.id.bt_ok);
buttonOK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}