M
M
MVBWAW212021-03-18 10:46:20
Java
MVBWAW21, 2021-03-18 10:46:20

How to swipe to open activity listview?

I have a listview that opens an rtsp stream of cameras when clicked. Is it possible to use swipes to change the list item already in an open activity. That is, in the list I selected camera 1 and already when it opened with a swipe, I switched to camera 2.3, and so on. The method for swipes is already registered. I don't know how to get the next element from the bunle.

@Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

                HashMap<String, Object> i = (HashMap<String, Object>)arg0.getItemAtPosition(position);

                Intent intent = new Intent(getActivity(), CameraViewActivity.class);
                Bundle b = new Bundle();

                b.putString("video_uri", i.get("uri").toString());
                b.putString("title", i.get("display_name").toString());
                b.putString("id",i.get("id").toString());


                intent.putExtras(b);

                lv.setEnabled(false);

                startActivity(intent);
            }
        });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2021-03-18
@MVBWAW21

Yes you can, of course. You need to write code for this. Use ViewPager or RecyclerView + LinearLayoutManager(horizontal). In it, show your camera view as a page.
You don’t need to open a separate activity for this at all, you need to use fragments (Fragment).
You don't need to use ListView either, you need to use RecyclerView + LinearLayoutManager(vertical).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question