来自第二个活动的listview上的Android Next项目 [英] Android Next item on listview from second Activity

查看:59
本文介绍了来自第二个活动的listview上的Android Next项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到显示消息的适配器的列表视图,但是,我试图在另一个活动中实现下一个和上一个按钮.

I have a listview connected to an adapter showing messages but, I am trying to implement next and previous buttons in a different activity.

问题是当从另一个活动(详细视图活动)中单击按钮时,如何在列表视图中显示下一个或上一个项目.

The problem is how do u show the next or previous item on the listview when a button is clicked from another activity (detailed view activity).

我在这里输入了图像描述:

I have entered image description here :

随附的是带有下一个和上一个按钮的项目的屏幕截图

推荐答案

无论使用什么适配器,都需要从数组或数组列表中获取数据.适配器在创建时需要数组或数据列表.您可以存储此数组或列表以供进一步访问

You need to get the data from the array or arraylist whatever you are using for adapter. Adapter needs either array or list of data while creating. you can store this array or list for further access

尝试执行以下步骤

  • 当您选择任何特定项目时,您将获得该项目的位置.将此位置存储为计数器变量.
  • 根据位置,您将在某些视图中显示一些数据.
  • 当您单击下一步按钮时,增加计数器
  • 类似地,当您单击上一个按钮时,减少计数器
  • 使用此计数器值从列表视图中使用的数组或列表中获取数据

这篇关于来自第二个活动的listview上的Android Next项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆