在点击事件上显示警报消息框
我有一个应用程序,其中有选项卡主机。我的选项卡主机中有四个选项卡,其中一个选项卡包含一些元素的列表。现在,当用户单击第三个选项卡的元素时,他应该切换到第一个选项卡,并且列表元素的数据将显示在那里。但是,当用户最初尝试单击第一个选项卡而不从第三个选项卡的列表中选择任何元素时,我需要显示“请从列表中选择一个项目”的警报消息,
我想知道具体该怎么做?
谢谢, 大卫
I have an application where I have Tab Host. I have certainly four tabs in my Tab Host and one of my tab contains a list of some elements. Now When a user click on the element of the third Tab he is supposed to switched to the first tab and the data of the list element gets displayed there. But when the user initially tries to click on the first Tab without selecting any element from the list of third tab, I need to display the Alert Message that "Please select an item form the List"
I wonder how to do that particularly?
Thanks,
david
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 AlertDialog。
use AlertDialog.
在您的点击事件中使用它。
use it on your click event.
您可以使用上述任何一项,但我觉得您更感兴趣的是它的逻辑。
每个选项卡可能有四个不同的活动。
创建 more 类,它将作为您的 Bean 类,它保存在类之间传输信息的所有数据。
逻辑如下:
我希望你能明白逻辑
You can use any of the above, but I feel its the logic that you're more interested in.
You might be having four different activities for each tab.
Create on more class, which will serve as your Bean class, which holds all the data to transfer information between classes.
The logic goes as this:
I hope you got the logic