Kegiatan Selama Ramadhan

Bulan Ramadhan selalu membawa suasana yang tenang, senang, dan nyaman, sehingga ia dirindukan oleh umat manusia.

Pada bulan tersebut, satu keluarga dapat sahur dan buka bersama. Ketika petang kita mencari takjil dan banyak yang melantunkan Al-Qur’an di masjid dan mushala.

Selain itu, tidak jarang kita juga dapat bertemu dan berkumpul dengan teman lama untuk berbuka puasa bersama.

Selama bulan ramadhan saya melakukan kegiatan

  • Sahur.
  • Tadarus Qur'an.
  • Pergi pesantren
  • Membaca komik/novel.
  • Tidur siang.
  • Buka puasa.

Membuat ImageView

 Dalam Membua ImageView Kita Perlu Membuat Code Berikut Di                                     File activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:text="REKOMENDASI NOVEL"
android:textAlignment="center"
android:textSize="30dp"
android:background="@color/purple_500"
android:textColor="@color/white"
/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/novel3"

/>
</RelativeLayout>
<RelativeLayout ----->Copy Dari Sini
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="25dp">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="@drawable/bumi1" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="BUMI"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_marginLeft="100dp"
android:background="#006400"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="40dp"
android:textColor="#FFFFFF"
android:textSize="15dp"

/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="110dp"
android:src="@drawable/buku" />
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pengarang : TERE LIYE"
android:layout_alignParentTop="true"
android:layout_marginLeft="100dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Harga : RP 150.000"
android:layout_alignParentTop="true"
android:layout_marginLeft="100dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Penerbit : TERE LIYE"
android:layout_alignParentTop="true"
android:layout_marginLeft="100dp"/>

</LinearLayout>


</RelativeLayout>---->Sampai Sini
</LinearLayout>

    Dan Ini Contoh Hasil Dari Code Diatas


GUI CheckBox And RadioButton

 Untuk Membuat CheckBox Dan Radio Button Pada Android Studio         Maka Buatlah Codingan berikut Pada File activity_main.xml                                                                                                               

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    
   xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:text="FORM INPUT"
android:textAlignment="center"
android:textSize="30dp"
android:background="@color/purple_500"
android:textColor="@color/white"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="50dp"
android:orientation="vertical"
>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="NO.ID"
app:layout_constraintTop_toTopOf="@+id/txtTime"
android:layout_marginTop="5dp"
/>

<EditText
android:id="@+id/txtId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="INPUT NO ID"
android:inputType="number"
/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="NAMA"
app:layout_constraintTop_toTopOf="@+id/txtId"
android:layout_marginTop="5dp"
/>

<EditText
android:id="@+id/txtNama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="INPUT NAMA"
android:inputType="text"
/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="EMAIL"
app:layout_constraintTop_toTopOf="@+id/txtNama"
android:layout_marginTop="5dp"
/>

<EditText
android:id="@+id/txtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="INPUT EMAIL"
android:inputType="textEmailAddress"
/>

</LinearLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Hobi"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="260dp"
/>
<LinearLayout
android:id="@+id/lnHobi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="280dp">
<CheckBox
android:id="@+id/chcSilat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Silat"/>


<CheckBox
android:id="@+id/chcKarate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Karate"/>

</LinearLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Jenis Kelamin"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="330dp"
/>
<RadioGroup
android:id="@+id/rgJk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="350dp"
android:orientation="horizontal">

<RadioButton
android:id="@+id/rdLaki"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Laki-Laki"/>


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

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="SIMPAN"
app:layout_constraintTop_toTopOf="@id/rgJk"
android:layout_marginTop="50dp"
android:textSize="20dp"
android:onClick="simpan"
tools:ignore="OnClick" />
<TextView
android:id="@+id/lblId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ID"
android:textSize="20dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="480dp"/>

<TextView
android:id="@+id/lblNama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="NAMA"
android:textSize="20dp"
app:layout_constraintTop_toTopOf="@+id/lblId"
android:layout_marginTop="40dp"/>

<TextView
android:id="@+id/lblEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="EMAIL"
android:textSize="20dp"
app:layout_constraintTop_toTopOf="@+id/lblNama"
android:layout_marginTop="40dp"/>

<TextView
android:id="@+id/lblHobi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="HOBI"
android:textSize="20dp"
app:layout_constraintTop_toTopOf="@+id/lblEmail"
android:layout_marginTop="40dp"/>


<TextView
android:id="@+id/lblJk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Jenis Kelamin"
android:textSize="20dp"
app:layout_constraintTop_toTopOf="@+id/lblHobi"
android:layout_marginTop="40dp"/>


</androidx.constraintlayout.widget.ConstraintLayout>

Setelah Membuat Code Diatas Untuk Mengaktifkan Tombol Button Agar Saat Kita Click Akan Memunculkan Data Yang Kita Input Maka Buatlah Codingan Berikut Pada File MainActivity.java   
package com.example.rpl1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void simpan(View view) {
//untuk menyimpan data yang di input
EditText Id = findViewById(R.id.txtId);
EditText Nama = findViewById(R.id.txtNama);
EditText Email = findViewById(R.id.txtEmail);
CheckBox Silat = findViewById(R.id.chcSilat);
CheckBox Karate = findViewById(R.id.chcTaekwondo);
RadioGroup Jk = findViewById(R.id.rgJk);

//menyimpan data
TextView setId = findViewById(R.id.lblId);
TextView setNama = findViewById(R.id.lblNama);
TextView setEmail = findViewById(R.id.lblEmail);
TextView setSilat = findViewById(R.id.lblHobi);
TextView setTaekwondo = findViewById(R.id.lblHobi);
TextView setJk = findViewById(R.id.lblJk);

int tId = Integer.parseInt(Id.getText().toString());
String getNama = Nama.getText().toString();
String getEmail = Email.getText().toString();
String getSilat = Silat.getText().toString();
String getTaekwondo = Karate.getText().toString();

int jk = Jk.getCheckedRadioButtonId();
Button Gender = findViewById(jk);
String gender = Gender.getText().toString();


//menampilkan
setId.setText(Integer.toString(tId));
setNama.setText(getNama);
setEmail.setText(getEmail);
setSilat.setText(getSilat);
setTaekwondo.setText(getTaekwondo);
setJk.setText(gender);

}
                        Setelah Membuat Codingan Diatas Maka Menghasilkan Tampilan Berikut :

Sekian Penjelasan Dari Saya,Saya Ucapkan Terima Kasih.




GUI Layout

Untuk Mengatur Layout Maka Buatlah Code Berikut Di File                                                 activity_main.xml 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">


<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="4dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="365dp"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="belajar"
android:textSize="50dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="coba"
android:textSize="50dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="belajar"
android:textSize="50dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="belajar"
android:textSize="50dp"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="belajar"
android:textSize="50dp"/>


</LinearLayout>

<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="365dp"
app:layout_constraintTop_toTopOf="parent">


<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="simpan" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="rubah" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="save" />


<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="back" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test"
android:textSize="30dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
/>


</RelativeLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

        Dan Ini Hasil Dari Codingan Diatas


Contoh Codingan Getter and Setter




Codingan di file Activity_main.xml
<EditText
android:id="@+id/txtNama"
android:hint="Nama :"
android:layout_marginTop="30dp"
android:textSize="18dp"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<EditText
android:id="@+id/txtJurusan"
android:hint="Jurusan :"
android:layout_marginTop="30dp"
android:textSize="18dp"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<EditText
android:id="@+id/txtkelas"
android:hint="kelas :"
android:layout_marginTop="30dp"
android:textSize="18dp"
android:inputType="text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:onClick="cek"
android:text="Simpan"/>
<TextView
android:id="@+id/lblNama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="28dp"
android:textAlignment="center"
android:text="Nama :" />

<TextView
android:id="@+id/lblJurusan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="28dp"
android:textAlignment="center"
android:text="Jurusan :" />

<TextView
android:id="@+id/lblKelas"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="28dp"
android:textAlignment="center"
android:text="Kelas :" />

Berikut ini Codingan Di file MainActivity.java

package com.example.rpl1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}

public void cek(View view) {
//input Nama
EditText Nama = findViewById(R.id.txtNama);
TextView setNama = findViewById(R.id.lblNama);

//input Jurusan
EditText Jurusan = findViewById(R.id.txtJurusan);
TextView setJurusan = findViewById(R.id.lblJurusan);

//input kelas
EditText Kelas = findViewById(R.id.txtkelas);
TextView setKelas = findViewById(R.id.lblKelas);

//proses
String getNama =Nama.getText().toString();
String getJurusan =Jurusan.getText().toString();
String getKelas =Kelas.getText().toString();


//output
setNama.setText(getNama);
setJurusan.setText(getJurusan);
setKelas.setText(getKelas);
}
}

Dan Ini Hasil Dari Codingan Diatas