You are on page 1of 6

Pemrograman Mobile I, Fransiskus Zoromi, M.

Kom 2017

Pertemuan 8
Intent Multi Activity

Application Name : Intent Multy Activity


Min. SDK : Android 4.1 (Jelly Bean)
Activity : Empty Activity
Activity Name : MainActivity.java
Layout Name : activity_main.xml
Pemrograman Mobile I, Fransiskus Zoromi, M. Kom 2017

Application Name : Intent Multy Activity


Min. SDK : Android 4.1 (Jelly Bean)
Activity : Empty Activity
Activity Name :login.java
Layout Name : activity_login.xml
Pemrograman Mobile I, Fransiskus Zoromi, M. Kom 2017

Application Name : Intent Multy Activity


Min. SDK : Android 4.1 (Jelly Bean)
Activity : Empty Activity
Activity Name :login.java
Layout Name : activity_login.xml

MainActivity.java

package com.example.jackfrostssd.intermultiactivity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
Pemrograman Mobile I, Fransiskus Zoromi, M. Kom 2017

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button login=(Button)findViewById(R.id.btn_login_home_id);
Button daftar=(Button)findViewById(R.id.btn_register_home_id);
}

public void btn_login_home_klik(View view){


Intent login=new Intent(this,login.class);
startActivity(login);
}
public void btn_register_home_klik(View view) {
Intent daftar = new Intent(this, register.class);
startActivity(daftar);
}

Login.java

package com.example.jackfrostssd.intermultiactivity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class login extends AppCompatActivity {

EditText input_username,input_password;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
input_username=(EditText)findViewById(R.id.txt_form_login_id);
input_password=(EditText)findViewById(R.id.txt_form_password_id);
}

public void btn_batal_klik(View view){


input_password.setText("");
input_username.setText("");

}
Pemrograman Mobile I, Fransiskus Zoromi, M. Kom 2017

register.java
package com.example.jackfrostssd.intermultiactivity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class register extends AppCompatActivity {


EditText input_register_email,input_register_password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);

input_register_password=(EditText)findViewById(R.id.txt_register_password_id);
input_register_email=(EditText)findViewById(R.id.txt_register_email_id);

}
public void btn_batal_register_klik(View view){
input_register_password.setText("");
input_register_email.setText("");
}

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.jackfrostssd.intermultiactivity">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />


</intent-filter>
</activity>

<activity android:name=".login" />


Pemrograman Mobile I, Fransiskus Zoromi, M. Kom 2017

<activity android:name=".register"></activity>

</application>

</manifest>