You are on page 1of 5

Main activity

<?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"
android:text="Login"
android:layout_marginTop="50dp"
android:textAlignment="center"
android:textSize="35sp"
/>

<LinearLayout
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:layout_marginTop="40dp">

<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@drawable/logo" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:orientation="horizontal">

<TextView
android:layout_width="20dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:text="User Name"
android:textStyle="bold"
android:textSize="20sp"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="50dp"
android:inputType="textPersonName"
android:background="#DCDCDC"
android:textSize="20sp"/>

</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Password"
android:textStyle="bold"
android:textAlignment="center"
android:textSize="20sp"/>

</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:layout_marginTop="20dp"
android:inputType="textPassword"
android:layout_marginLeft="135dp"
android:background="#DCDCDC"
tools:ignore="SpeakableTextPresentCheck" />
</LinearLayout>

<Button
android:id="@+id/button"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="login" />

</LinearLayout>

Java

package com.example.a1911151_hendika_irawan;

import androidx.appcompat.app.AppCompatActivity;

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

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button;
button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent button;
button = new Intent(MainActivity.this, konvert.class);
startActivity(button);
}
});
}
}

konvert activity

<?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=".konvert">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Program Converter"
android:layout_marginTop="30dp"
android:textAlignment="center"
android:textSize="35sp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Rupiah"
android:textAlignment="center"
android:textSize="24sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<EditText
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="1"
android:ems="10"
android:layout_marginTop="20dp"
android:inputType="textPassword"
android:layout_marginLeft="130dp"
android:background="#DCDCDC"
tools:ignore="SpeakableTextPresentCheck" />
</LinearLayout>

<Button
android:id="@+id/convert"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="Convert" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Rupiah"
android:layout_marginLeft="45dp"
android:textSize="24sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="70dp"
android:text="Yen"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:layout_width="130dp"
android:layout_height="30dp"
android:layout_weight="1"
android:ems="10"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:inputType="textPassword"
android:background="#DCDCDC"
tools:ignore="SpeakableTextPresentCheck"/>
<EditText
android:layout_width="130dp"
android:layout_height="30dp"
android:layout_weight="1"
android:ems="10"
android:layout_marginTop="10dp"
android:inputType="textPassword"
android:layout_marginLeft="120dp"
android:background="#DCDCDC"
tools:ignore="SpeakableTextPresentCheck" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAlignment="center"
android:text="Baht"
android:textSize="24sp"
/>

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<EditText
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_weight="1"
android:ems="10"
android:layout_marginLeft="160dp"
android:layout_marginTop="10dp"
android:inputType="textPassword"
android:background="#DCDCDC"
tools:ignore="SpeakableTextPresentCheck" />
</LinearLayout>

<Button
android:id="@+id/keluar"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="50dp"
android:text="logout" />
</LinearLayout>

konvert java

package com.example.a1911151_hendika_irawan;

import androidx.appcompat.app.AppCompatActivity;

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

public class konvert extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_konvert);
Button keluar;
keluar = (Button) findViewById(R.id.keluar);
keluar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent keluar;
keluar = new Intent(konvert.this, MainActivity.class);
startActivity(keluar);
}
});
}
}

You might also like