Thank you for that, so the other screen doing what I want it to do
would be a whole other Java File?

How do I set up a listener on the button as there is already a
listener on the gallery?

Sorry if this soulds basic, but I am just learning ;-)

On Jun 24, 8:09 pm, Justin Anderson <janderson....@gmail.com> wrote:
> When you click the button, launch a new activity with startActivity().  That
> method takes an Intent through which you can pass data to the activity you
> are calling.
>
> When you do it this way, pressing the back button automatically has the
> effect you want by virtue of how the Android OS works.
>
> ----------------------------------------------------------------------
> There are only 10 types of people in the world...
> Those who know binary and those who don't.
> ----------------------------------------------------------------------On Thu, 
> Jun 24, 2010 at 10:04 AM, Justin <justinbrett1...@gmail.com> wrote:
> > I have written a app, and I have pictures which are stored in the /
> > drawable directory.  My app makes a sliding gallery across the top,
> > (id gallery1) and as you select the picture in the gallery it load
> > the
> > picture bigger underneath, (id image1). These a layed out in a XML
> > file.  There is a button below the image (image1) which is called (id
> > mybutton).
> > I want it when a image comes up, when the button is pressed it loads
> > the same image on a XML layout file, in which the picture is full
> > screen, the ID of the XML file image is (id bigpic), and then from
> > there to beable to press the back button to go back to the gallery
> > screen.  Can anyone help?
>
> > My Whole Code is:
>
> > ***************************************************************************­­
> > ******************
> > public class PicViews extends Activity
> > {
> >    //---the images to display---
> >    Integer[] imageIDs = {
> >            R.drawable.pic01,
> >            R.drawable.pic02,
> >            R.drawable.pic03,
> >            R.drawable.pic04,
> >            R.drawable.pic05
>
> >    };
>
> >   �...@override
> >    public void onCreate(Bundle savedInstanceState)
> >    {
> >        super.onCreate(savedInstanceState);
> >        setContentView(R.layout.displayview);
>
> >        Gallery gallery = (Gallery) findViewById(R.id.gallery1);
>
> >        gallery.setAdapter(new ImageAdapter(this));
> >        gallery.setOnItemClickListener(new OnItemClickListener()
> >        {
> >                 public void onItemClick(AdapterView parent,
> >                            View v, int position, long id)
> >                            {
> >                                //---display the images selected---
> >                                ImageView imageView = (ImageView)
> > findViewById(R.id.image1);
>
> > imageView.setImageResource(imageIDs[position]);
> >                            }
> >        });
> >    }
>
> >    public class ImageAdapter extends BaseAdapter
> >    {
> >        private Context context;
> >        private int itemBackground;
>
> >        public ImageAdapter(Context c)
> >        {
> >            context = c;
> >            //---setting the style---
> >            TypedArray a =
> > obtainStyledAttributes(R.styleable.Gallery1);
> >            itemBackground = a.getResourceId(
> >                R.styleable.Gallery1_android_galleryItemBackground,
> > 0);
> >            a.recycle();
> >        }
>
> >        //---returns the number of images---
> >        public int getCount() {
> >            return imageIDs.length;
> >        }
>
> >        //---returns the ID of an item---
> >        public Object getItem(int position) {
> >            return position;
> >        }
>
> >        public long getItemId(int position) {
> >            return position;
> >        }
>
> >        //---returns an ImageView view---
> >        public View getView(int position, View convertView, ViewGroup
> > parent) {
> >            ImageView imageView = new ImageView(context);
> >            imageView.setImageResource(imageIDs[position]);
> >            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
> >            imageView.setLayoutParams(new Gallery.LayoutParams(150,
> > 120));
> >            imageView.setBackgroundResource(itemBackground);
> >            return imageView;
> >        }
> >    }
>
> > }
>
> > ***************************************************************************­­
> > ******************
>
> > The Section of code which pulls up the image and makes the bigger
> > picture show is:
>
> > ***************************************************************************­­
> > ******************
> >  gallery.setOnItemClickListener(new OnItemClickListener()
> >        {
> >                 public void onItemClick(AdapterView parent,
> >                            View v, int position, long id)
> >                            {
> >                                //---display the images selected---
> >                                ImageView imageView = (ImageView)
> > findViewById(R.id.image1);
>
> > imageView.setImageResource(imageIDs[position]);
> >                            }
> >        });
>
> > ***************************************************************************­­
> > *******************
>
> > Please help, I'm only learning.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Beginners" group.
>
> > NEW! Try asking and tagging your question on Stack Overflow at
> >http://stackoverflow.com/questions/tagged/android
>
> > To unsubscribe from this group, send email to
> > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr­...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to