0

Is this Possible? I have an intent in my main activity

routeListView.setOnItemClickListener(
            new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                    String route = values[position];

                    //for loop to increment through each route list item
                    int i;
                    for (i=0; i < values.length;i++)
                    {
                        int imageId = (int) image.getResourceId(i, -1);
                        if (route.equals(values[i]))
                        {
                            Intent intent = new Intent(view.getContext(),     RouteDetails.class);
                            intent.putExtra("route", routeDetail[i]);
                            intent.putExtra("imageResourceId", imageId);
                            startActivity(intent);
                        }
                    }
                }
            }

right now I have it passing the image to RouteDetails.class but I also want to pass the same image to FullScreenImage.class. I want the route details activity to open but not the FullScreenImage activity. And then later be able to open the FullScreenImage.class activity from RouteDetails.class Is there a simple way to accomplish this?

  • You can simply pass your route and imageResourceId to RouteDetails Activity, and then pass it to FullScreenImage Activity afterwards. – Tosin Onikute Nov 15 '16 at 23:16
  • How would I pass the image resource Id. Like the syntax – user4297729 Nov 16 '16 at 00:06
  • You simply pass it as an int value, and get retrieve it as in int value also – Tosin Onikute Nov 16 '16 at 00:11
  • Could you give me an example by any chance? Because I was trying to do that before but couldn't get the proper syntax down. Like I created an intent in my route details class and was trying to pass it into my full size image class but it wouldn't work. – user4297729 Nov 16 '16 at 00:55
  • You mean passing the drawable image itself ? – Tosin Onikute Nov 16 '16 at 02:08
  • I had originally asked this question http://stackoverflow.com/questions/40619024/onclicklistener-on-imageview-to-start-new-intent but the answer I got in there was hard for me to understand and I was hoping for a simpler way to accomplish it. So I created this topic looking at a different method. If you could look at that other question I had asked maybe you could see a more straight forward method. – user4297729 Nov 16 '16 at 02:15

0 Answers0