0% menganggap dokumen ini bermanfaat (0 suara)
246 tayangan12 halaman

Membuat Aplikasi Android

apliaksi denganandroid

Diunggah oleh

Ery Gunawan
Hak Cipta
© © All Rights Reserved
Kami menangani hak cipta konten dengan serius. Jika Anda merasa konten ini milik Anda, ajukan klaim di sini.
Format Tersedia
Unduh sebagai DOC, PDF, TXT atau baca online di Scribd
0% menganggap dokumen ini bermanfaat (0 suara)
246 tayangan12 halaman

Membuat Aplikasi Android

apliaksi denganandroid

Diunggah oleh

Ery Gunawan
Hak Cipta
© © All Rights Reserved
Kami menangani hak cipta konten dengan serius. Jika Anda merasa konten ini milik Anda, ajukan klaim di sini.
Format Tersedia
Unduh sebagai DOC, PDF, TXT atau baca online di Scribd
Anda di halaman 1/ 12

MEMBUAT APLIKASI ANDROID “CURRICULUM VITAE”

TUGAS UAS

Dibuat Untuk Memenuhi Salah Satu tugas matakuliah pemrograman java


Dosen pengampu : Edy Subowo

Diajukan Oleh :
DESVITA AYUNINGTYAS
MI.16.00331

PROGRAM DIPLOMA III MANAJEMEN INFORMATIKA


POLITEKNIK MUHAMMADIYAH PEKALONGAN
PEKALONGAN
2018
Activity_main

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout
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="com.example.user.curiculumvitae.MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SILAHKAN LOGIN"
android:textSize="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.08"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="29dp"
android:id="@+id/textView" />

<EditText
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="138dp"
android:ems="10"
android:inputType="textPersonName"
android:hint="Masukan Username"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true" />

<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/username"
android:layout_alignStart="@+id/username"
android:layout_below="@+id/username"
android:layout_marginTop="15dp"
android:ems="10"
android:inputType="textPassword"
android:hint="Masukan Password" />
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:text="Tampilkan Password"
android:layout_below="@+id/password"
android:layout_alignLeft="@+id/password"
android:layout_alignStart="@+id/password" />

<Button
android:id="@+id/login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="33dp"
android:text="login"
android:onClick="login"
android:layout_below="@+id/checkBox"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="11dp"
android:text="Masukan username dan password dengan benar"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true" />

</RelativeLayout>
MainActivity

package com.example.user.curiculumvitae;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.content.Intent;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


EditText editText1 ,editText2;
CheckBox checkbox1;
String text1 ,text2;

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

editText2 = (EditText) findViewById(R.id.password);


//Memanggil ID EditText
checkbox1 = (CheckBox) findViewById(R.id.checkBox);
//Memanggil ID Checkbox
checkbox1.setOnCheckedChangeListener(new
CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (!isChecked){

editText2.setTransformationMethod(PasswordTransformationMethod.getIn
stance());
}else{

editText2.setTransformationMethod(HideReturnsTransformationMethod.ge
tInstance());
}
}
});
}
public void login(View view) {
editText1 = (EditText)findViewById(R.id.username);
//Memanggil ID EditText
editText2 = (EditText) findViewById(R.id.password);
//Memanggil ID EditText
text1 = editText1.getText().toString(); //Mengambil value
(nilai) pada username
text2 = editText2.getText().toString(); //Mengambil value
(nilai) pada password
if ((text1.contains("admin"))&&((text2.contains("admin"))))
{
Toast.makeText(this, "Anda Berhasil Login",
Toast.LENGTH_SHORT).show(); //Menampilkan toast
Intent intent = new Intent(MainActivity.this,
Home2Activity.class); //Berpindah activity
startActivity(intent); //Menjalankan Activity
}
else if ((text1.matches("")||text2.matches("")))
{
Toast.makeText(this, "Isikan Username dan Password",
Toast.LENGTH_SHORT).show(); //menampilkan toast
}
else
{
Toast.makeText(this, "Maaf Username/Password Salah",
Toast.LENGTH_SHORT).show(); //menampilkan toast
}
}
}
Activity_home

<?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"
tools:context="com.example.user.curiculumvitae.Home2Activity">

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

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

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">

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

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Nama : DESVITA AYUNINGTYAS"
android:textSize="16dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="TTL : 29 Desember 1997"
android:textSize="16dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="'ALLAH tidak membebani
seseorang itu melainkan sesuai dengan kesanggupannya'"
android:textSize="15dp" />

<ImageView
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:background="@drawable/dessvit" />

</LinearLayout>
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">

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

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Video Favorit"
android:textSize="15dp" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Love Videos"
android:textSize="20dp" />

<VideoView
android:id="@+id/video"
android:layout_width="300dp"
android:layout_height="200dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center_horizontal"
/>/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</LinearLayout>
HomeActivity

package com.example.user.curiculumvitae;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.net.Uri;
import android.media.MediaPlayer;
import android.widget.MediaController;
import android.widget.VideoView;

public class Home2Activity extends AppCompatActivity {


MediaPlayer mp;
VideoView videoView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home2);
mp = new MediaPlayer();
getSupportActionBar().setTitle("Video Offline");
getSupportActionBar().setSubtitle("VideoKu");
videoView = (VideoView) findViewById(R.id.video);
videoView.setVideoURI(Uri.parse("android.resource://" +
getPackageName() + "/" + R.raw.vita));
videoView.setMediaController(new MediaController(this));
videoView.start();
}
}
APK

compileSdkVersion 26
defaultConfig {
applicationId "com.example.user.curiculumvitae"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-
android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-
layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation
'com.android.support.test:runner:1.0.2'
androidTestImplementation
'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.android.support:cardview-v7:26.1.0'
}

Anda mungkin juga menyukai