Belajardengan.com merupakan domain blog lama dari delajardengan.blogspot.com. Mohon kritik dan sarannya untuk perkembangan blog ini.
email: blog.tkx.pnp@gmail.com

coba Belajar Adroid (5)

♠ Posted by Unknown in at 9:47 PM
source code  5


Tes2sanActivity.java


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Tes2sanActivity extends Activity implements OnClickListener{
    /** Called when the activity is first created. */
Button btn;
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         btn= (Button)this.findViewById(R.id.button1);
    }
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v==btn){
finish();
}
}
}

main.xml


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>


hasilnya:




0 komentar:

Post a Comment