Hi Divya

Plse  copy the pgm



Create an android  program in 2.2 named " HelloUIActivity"  the package name
is "lello.tab"  and the activity nae is "HelloUIActivity"

copy the file and paste

************************************
package lello.tab;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

public class HelloUIActivity extends Activity implements OnClickListener{


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button sSquare =(Button) findViewById(R.id.getCircle);
        sSquare.setOnClickListener(this);
        Button   sCircle =(Button) findViewById(R.id.getSquare);
        sCircle.setOnClickListener(this);

    }

        public void onClick(View v)
        {
            switch (v.getId()) {
                case R.id.getSquare:
                    ImageView imageView = (ImageView)
findViewById(R.id.getSquare1);
                    imageView.setImageResource(R.drawable.icon);

                    break;

             case R.id.getCircle:
                 ImageView imageView1 = (ImageView)
findViewById(R.id.getCircle1);
                 imageView1.setImageResource(R.drawable.icon);

                 break;
            }


}
}
************************************************************

The main.xml is
<?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"
    >
<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    />
<Button android:text="Button"
android:id="@+id/getSquare"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content">
 </Button>
<Button android:text="Button"
android:id="@+id/getCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
android:id="@+id/getSquare1">
</ImageView>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
android:id="@+id/getCircle1">
</ImageView>
</LinearLayout>

***********************************
I am not placed the button in bottom only 1 by 1

try it it will get

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to