Professional Documents
Culture Documents
2E 361555401097 Moh Syahrul Ramadhan Form
2E 361555401097 Moh Syahrul Ramadhan Form
Oleh :
Moh. Syahrul Ramadhan (361555401097)
Teknik Informatika
Politeknik Negeri Banyuwangi
2017
Source code “Login.java”
package com.a361555401097.form;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
login.setOnClickListener(new View.OnClickListener() {
@Override
Login.this.finish();
});
daftar.setOnClickListener(new View.OnClickListener() {
@Override
Login.this.startActivity(intent);
Login.this.finish();
});
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.a361555401097.form.Login">
<!-- Login progress -->
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_username"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/login"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_login"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView4"
<Button
android:id="@+id/sign_up_button"
style="?android:textAppearanceSmall"
android:layout_width="143dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/action_sign_up"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Screenshot:
Analisa : pada file login terdapat field username dan password, dimana username bertipe “text”
sedangkan field password bertipe “password” dan juga terdapat button login yang mengarah pada file
“tampil.java” dan button sign up yang mengarah pada file “ daftar.java”. untuk mengarahkan file
menggunakan inten dengan format Intent intent = new Intent(Login.this, tampil.class); untuk
mengarahkan button login ke “file tampil.java” dan Intent intent = new Intent(Login.this, daftar.class);
untuk mengarahkan tombol sign up ke file “daftar.java”
Source Code File Daftar.java
package com.a361555401097.form;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_daftar);
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Nama Lengkap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/nama" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/nama" />
<TextView
android:text="No.Handphone /Telepon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/telepon" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/telepon" />
<TextView
android:text="Toko / Usaha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toko" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/toko" />
<TextView
android:text="Email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/email" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/email" />
<TextView
android:text="Password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/password" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/password" />
<TextView
android:text="Pilih Paket"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/paket" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/spinner" />
</LinearLayout>
Screenshoot:
Analisa :
Di dalam file activity_daftar.xml terdapat field nama lengkap, no handphone, took, email,
password dan spinner pilih paket
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tampil);
logout.setOnClickListener(new View.OnClickListener() {
@Override
tampil.this.startActivity(intent);
tampil.this.finish();
});
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView" />
<Button
android:text="DASHBOARD"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button" />
<Button
android:text="ORDER"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button2" />
<Button
android:text="PRODUK"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button3" />
<Button
android:text="LAPORAN"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button4" />
<Button
android:text="SETTING"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button5" />
<Button
android:text="LOGOUT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/logout" />
</LinearLayout>
Screenshoot :