Cleint server 12
Assalam’alaikum warohmatulahi wabarokatu..
Baiklah pada blog kali ini saya akan menjelaskan apikasi client server android, database,dan mysql..
Activity_main.xml
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/menu"
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=".MainActivity" >
<Button
android:id="@+id/btnpesan"
android:layout_width="75dp"
android:layout_height="79dp"
android:layout_x="156dp"
android:layout_y="232dp"
android:background="@drawable/icon_pesan" />
<Button
android:id="@+id/btnhome"
android:layout_width="75dp"
android:layout_height="79dp"
android:layout_x="51dp"
android:layout_y="235dp"
android:background="@drawable/icon_home" />
<Button
android:id="@+id/btninformasi"
android:layout_width="75dp"
android:layout_height="79dp"
android:layout_x="51dp"
android:layout_y="330dp"
android:background="@drawable/icon_informasi"
android:text="" />
<Button
android:id="@+id/btnkeluar"
android:layout_width="75dp"
android:layout_height="79dp"
android:layout_x="156dp"
android:layout_y="330dp"
android:background="@drawable/icon_keluar"
android:text="" />
</AbsoluteLayout>
Main.java
package com.example.megis_kost;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
Button btnhome;
Button btnpesan;
Button btninformasi;
Button btnkeluar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button)findViewById(R.id.btnhome);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(MainActivity.this,Satu.class);
startActivity(intent);
}
});
Button button2=(Button)findViewById(R.id.btnpesan);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(MainActivity.this,Pesan.class);
startActivity(intent);
}
});
Button button3 = (Button)findViewById(R.id.btninformasi);
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(MainActivity.this,Lokasi.class);
startActivity(intent);
}
});
Button button4 = (Button)findViewById(R.id.btnkeluar);
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(MainActivity.this,Keluar.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Komentar
Posting Komentar