如何使用意图传递光标对象到下一个活动

编程入门 行业动态 更新时间:2024-10-05 03:20:24
本文介绍了如何使用意图传递光标对象到下一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我熟悉如何从一个活动传递原始数据(字符串,整型,布尔型等等)到另一个活动。但是,在我的应用程序,我想一个光标对象传递给下一个活动。我从活动类扩展我的课。

I'm familiar with how to pass Raw Data(String, int, boolean etc) from one Activity to another Activity. But in my application, I want to pass a Cursor object to next Activity. I'm extending my class from the Activity Class.

虽然我已经看过这个post.但是它提供cotradictory解决方案。然而,所描述的用户之一,应该延长应用程序类通过游标数据。但是我想延长活动类。那么,有没有办法从一个活动到另一个活动通过光标数据。

Though I have looked at this post. but it provides cotradictory solutions. However, as described by one of the users, one should extend Application class to pass cursor data. But I want to extend Activity class. So is there any way to pass Cursor data from an Activity to another Activity.

注意 - 如果有帮助,我为什么要使用光标的事实是,我是查询数据的特定联系人点击从列表并将其保存在游标,我想同样的光标数据传递到下一个Actvity。

Note- If it helps, the fact why I want to use the cursor is, I'm querying data for a particular contact clicked from the list and saving it in the cursor and I want to pass the same cursor data to the next Actvity.

推荐答案
  • 重新查询光标放在目标身边。
  • 店铺光标数据,它实现了Parcelable。(当你的光标数据在小尺寸)的类。

以上两种方法很好地工作,关心,当你处理静态的真的来了。

Above both method will work perfectly, concern really coming when you dealing with Static ones.

记住:要打开/关闭光标和数据库需要的时候的

更多推荐

如何使用意图传递光标对象到下一个活动

本文发布于:2023-11-28 04:23:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640945.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:光标   如何使用   意图   对象

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!