You can have just one imageview and keep updating the view's image.
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView o1 = (ImageView) findViewById(R.id.image);
o1.setOnClickListener(this);
}
public void onClick(View v)
{
switch (v.getId()) {
case R.id.image:
ImageView imageView = (ImageView) v;
//Update view here. you can use any one of the setimage
functions
imageView.setImageDrawable(Drawable drawable) OR
imageView.setImageBitmap(Bitmap bm)
break;
}
All you need in your XML is an ImageView.
Cheers,
Aravind
On Oct 29, 1:33 am, alok upadhyay <[email protected]> wrote:
> hi nena!!!
> i am also trying to do something like this!!!!
> i am also having three images and i am trying something like this
> i have all the images in my drawable folder.till now i am successful to get
> all three imagebuttons on the screen.
> my code is something like this:
>
> package com.example.Trial;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.View;
> import android.view.View.OnClickListener;
> import android.widget.ImageButton;
>
> public class Trial extends Activity implements OnClickListener
> {
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState)
> {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
>
> ImageButton o1 = (ImageButton) findViewById(R.id.btnSequence);
> o1.setOnClickListener(this);
>
> ImageButton o2 = (ImageButton) findViewById(R.id.btnVideo);
> o2.setOnClickListener(this);
>
> ImageButton o3 = (ImageButton) findViewById(R.id.btnInfo);
> o3.setOnClickListener(this);
> }
> �...@override
> public void onClick(View v)
> {
> switch (v.getId()) {
> case R.id.btnSequence:
> //here i want to write code so that a new intent open and on clicking
> this imagebutton a new image got opened
> //means on clicking this button a new image should be open in new screen
>
> break;
> case R.id.btnVideo:
> //here i want to write code so that a new intent open and on clicking
> this imagebutton a new video got opened
> break;
>
> case R.id.btnInfo:
> ////here i want to write code so that a new intent open and on clicking
> this imagebutton a new video got opened
> break;
> }
>
> }
>
> }
>
> i am thinking something like i have to call seperate activities after
> clicking on each button !!!!! is it so??please correct me if i am wrong
> any kind of help will be appreciated!!!
> thanks
>
>
>
>
>
>
>
>
>
> On Fri, Oct 29, 2010 at 9:55 AM, nena joy <[email protected]> wrote:
> > Hello,
>
> > I want to display 3 images one by one from drawable folder.
> > I did it using seperate intents.Means when click the first image,itwill
> > go the next intent and that loads second image and so on.
> > As the no of images increasing it should be very complecated.
> > So I want to show it in single intent.
> > Any one have an idea please help.
> > Thank you
>
> > --
> > 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]<android-developers%2Bunsubs
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Thanks & Regards
> Alok Upadhyay
> 9555758721
--
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