ericaddison / APT_miniProject_Android

The Android App for Connexus
0 stars 0 forks source link

Question about clicking items in the GridView #10

Closed psigourney closed 6 years ago

psigourney commented 6 years ago

This is the listener for the ViewAllStreams gridview. I see the "long id" parameter and added the putExtra to pass it through to the ViewAStream page, but the value is always 0. Is this "long id" the StreamID value for the image being clicked, or is it something else? Looking at the rest of the GridView code, it looks like maybe it just hasn't been implemented (only the image URL and name seem to be used currently)?

Any guidance?

       gridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View v,
                                    int position, long id) {
                Toast.makeText(ViewStreamsActivity.this, "You clicked on image " + position,
                        Toast.LENGTH_SHORT).show();

                Intent i = new Intent(v.getContext(), ViewAStreamActivity.class);

                i.putExtra("streamID", id);
                startActivity(i);
            }
        });
ericaddison commented 6 years ago

I have this working on my eric-viewstreams branch, put I haven't done a PR yet. Take a look here: https://github.com/ericaddison/APT_miniProject_Android/blob/eric-viewstreams/app/src/main/java/com/example/apt_miniproject_android/ViewStreamsActivity.java

psigourney commented 6 years ago

Cool thanks.