Thursday 21 June 2012

JAVA  CODE

Button bt=(Button)findViewById(R.id.button1);bt.setOnClickListener(new View.OnClickListener() {public void onClick(View v) {
Context context = getApplicationContext();
CharSequence text = "This is the Toast message!";
int duration = Toast.LENGTH_SHORT;Toast toast = Toast.makeText(context, text, duration);toast.show();
              
            }
        });



XML Code 

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/AbsoluteLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <Button
        android:id="@+id/button1"
        android:layout_width="251dp"
        android:layout_height="110dp"
        android:layout_x="34dp"
        android:layout_y="172dp"
        android:text="Click   Me" />

</AbsoluteLayout>

0 comments:

Post a Comment

Blogroll

Blogger templates

About