myname综艺(一个韩国组合)在qq上的兴趣部落叫什么

人与交马配图片欧洲,bishipin
<a href=".cn/heard/888.html" title="五月婷婷激情先锋,轮奸乱伦小说,国产三级电影图片小说,日本a动漫<五月婷婷激情先锋,轮奸乱伦小说,国产三级电影图片小说,日本a动漫<<美丽教师》视频,,你受惊了,我扶你去
友情链接:10197人阅读
&&&&&&& 前段时间跟大家分享了ExpandableListView的使用,不知道的童鞋,可以去这里看一下:
&&&&& & 但是我最近做那个QQ项目是遇到一个问题,如果给这个ExpandableListView添加动态从网上获取的数据呢?前面跟大家分享的时候,是用了静态的数据,很好处理。大组跟小组就类&#20284;于一个一维数组和二维数组,但我们从服务器获取的数据可能并不是这样!比如我做的这个QQ从服务器获取的就是一个List&User&,这么一个用户数组,那些分组信息都包含在每个用户之中,像这样的数据又该如何添加到适配器里面呢?好了,下面跟大家分享一下我的处理办法。先看一张效果图,有图有真相,哈哈:
下面是对应好友在数据库中的分组,自己本人默认为在第一组。QQ好像也是这么处理的
先看一下我们自定义的适配器代码,看看需要什么样的数据,然后根据需求,传递对应的数据。
* 自定义ExpandableListView的适配器
* @author way
public class MyExAdapter extends BaseExpandableListAdapter {
private int[] imgs = { R.drawable.icon, R.drawable.f1, R.drawable.f2,
R.drawable.f3, R.drawable.f4, R.drawable.f5, R.drawable.f6,
R.drawable.f7, R.drawable.f8, R.drawable.f9 };// 头像资源数组
private List&GroupFriend&// 传递过来的经过处理的总数据
public MyExAdapter(Context context, List&GroupFriend& group) {
this.context =
this.group =
// 得到大组成员的view
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.member_listview, null);
TextView title = (TextView) convertView.findViewById(R.id.content_001);
title.setText(getGroup(groupPosition).toString());// 设置大组成员名称
ImageView image = (ImageView) convertView.findViewById(R.id.tubiao);// 是否展开大组的箭头图标
if (isExpanded)// 大组展开时的箭头图标
image.setBackgroundResource(R.drawable.group_unfold_arrow);
// 大组合并时的箭头图标
image.setBackgroundResource(R.drawable.group_fold_arrow);
return convertV
// 得到大组成员的id
public long getGroupId(int groupPosition) {
return groupP
// 得到大组成员名称
public Object getGroup(int groupPosition) {
return group.get(groupPosition).getGroupName();
// 得到大组成员总数
public int getGroupCount() {
return group.size();
// 得到小组成员的view
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context);
convertView = inflater.inflate(R.layout.item, null);
final TextView title = (TextView) convertView
.findViewById(R.id.name_item);// 显示用户名
final TextView title2 = (TextView) convertView
.findViewById(R.id.id_item);// 显示用户id
ImageView icon = (ImageView) convertView
.findViewById(R.id.imageView_item);// 显示用户头像,其实还可以判断是否在线,选择黑白和彩色头像,我这里未处理,没资源,呵呵
final String name = group.get(groupPosition).getChild(childPosition)
.getName();
final String id = group.get(groupPosition).getChild(childPosition)
final int img = group.get(groupPosition).getChild(childPosition)
.getImg();
title.setText(name);// 大标题
title2.setText(id);// 小标题
icon.setImageResource(imgs[img]);
convertView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// 下面是添加到最近会话列表处理
RecentChatEntity entity = new RecentChatEntity(img, 0, name,
MyDate.getDateEN(), &&);
FriendListActivity.mRecentList.add(entity);
FriendListActivity.mRecentAdapter = new RecentChatAdapter(
context, FriendListActivity.mRecentList);
FriendListActivity.mRecentListView
.setAdapter(FriendListActivity.mRecentAdapter);
// 下面是切换到聊天界面处理
User u = new User();
u.setName(name);
u.setId(Integer.parseInt(id));
u.setImg(img);
Intent intent = new Intent(context, ChatActivity.class);
intent.putExtra(&user&, u);
context.startActivity(intent);
// Toast.makeText(Tab2.this, &开始聊天&, 0).show();
return convertV
// 得到小组成员id
public long getChildId(int groupPosition, int childPosition) {
return childP
// 得到小组成员的名称
public Object getChild(int groupPosition, int childPosition) {
return group.get(groupPosition).getChild(childPosition);
// 得到小组成员的数量
public int getChildrenCount(int groupPosition) {
return group.get(groupPosition).getChildSize();
* Indicates whether the child and group IDs are stable across changes to
* the underlying data. 表明大組和小组id是否稳定的更改底层数据。
* @return whether or not the same ID always refers to the same object
* @see Adapter#hasStableIds()
public boolean hasStableIds() {
// 得到小组成员是否被选择
public boolean isChildSelectable(int groupPosition, int childPosition) {
* 这个方法是我自定义的,用于下拉刷新好友的方法
* @param group
传递进来的新数据
public void updata(List&GroupFriend& group) {
this.group =
this.group =
从自定义适配器可以看出,需要一个List&GroupFriend&,这实际上也是我自定义的一个对象GroupFriend数组,为了方便处理,我把大组成员以及每个大组对应的小组成员都封装到GroupFriend这个对象中,下面我们来看一下GroupFriend的这个对象代码:
* 自定义的GroupFriend对象,用来封装大组名称和分配对应的数据
* @author way
public class GroupFriend {
private String groupN// 大组名称
private List&User& groupC// 对应大组的小组成员对象数组
public GroupFriend() {
public GroupFriend(String groupName, List&User& groupChild) {
this.groupName = groupN
this.groupChild = groupC
public void add(User u) {// 往小组中添加用户
groupChild.add(u);
public void remove(User u) {// 根据用户对象移除用户
groupChild.remove(u);
public void remove(int index) {// 根据下标移除用户
groupChild.remove(index);
public int getChildSize() {// 小组的大小
return groupChild.size();
public User getChild(int index) {// 根据下标得到用户
return groupChild.get(index);
// get...set...
public String getGroupName() {
return groupN
public void setGroupName(String groupName) {
this.groupName = groupN
public List&User& getGroupChild() {
return groupC
public void setGroupChild(List&User& groupChild) {
this.groupChild = groupC
好了,适配都根据我们的需求整完了,下面我们就处理一下服务器传递过来的List&User&对象(代码出自我的QQ项目中,我这里只截取其中重要的一部分):
private List&GroupFriend&//需要传递给适配器的数据
private String[] groupName = { &我的好友&, &我的同学&, &我的家人& };// 大组成员名
* 处理服务器传递过来的用户数组数据,
* @param list
从服务器获取的用户数组
private void initListViewData(List&User& list) {
group = new ArrayList&GroupFriend&();// 实例化
for (int i = 0; i & groupName. ++i) {// 根据大组的数量,循环给各大组分配成员
List&User& child = new ArrayList&User&();// 装小组成员的list
GroupFriend groupInfo = new GroupFriend(groupName[i], child);// 我们自定义的大组成员对象
for (User u : list) {
if (u.getGroup() == i)// 判断一下是属于哪个大组
child.add(u);
group.add(groupInfo);// 把自定义大组成员对象放入一个list中,传递给适配器
经过这个数据加工厂后生成的List&GroupFriend&,我们就可以用来实例化适配器对象了:
// 下面是处理好友列表界面处理
myListView = (MyListView) lay2.findViewById(R.id.tab2_listView);//获取我们自定义的可以下拉刷新的ListView对象
myExAdapter = new MyExAdapter(this, group);//实例化适配器
myListView.setAdapter(myExAdapter);//为我们自定义的ListView设置适配器
myListView.setGroupIndicator(null);// 不设置大组指示器图标,因为我们自定义设置了
myListView.setDivider(null);// 设置图片可拉伸的
myListView.setFocusable(true);// 聚焦才可以下拉刷新
myListView.setonRefreshListener(new MyRefreshListener());//监听下拉刷新状态
OK,大功告成,应该处理数据还有很多其他的办法,这只是我个人的一点思路而已,仅供参考,谢谢大家。
由于上面提到了我们自定义下拉刷新的ListView,下面顺便贴出,下拉刷新后的处理代码:
* 好友列表下拉刷新监听与实现,异步任务
* @author way
public class MyRefreshListener implements MyListView.OnRefreshListener {
public void onRefresh() {
new AsyncTask&Void, Void, Void&() {
List&User&
protected Void doInBackground(Void... params) {
// 从服务器重新获取好友列表
if (GetMsgService.isStart) {
ClientOutputThread out = GetMsgService.client
.getClientOutputThread();
TranObject o = new TranObject(TranObjectType.REFRESH);
o.setFromUser(Integer.parseInt(util.getId()));
out.setMsg(o);
// 为了及时收到服务器发过来的消息,我这里直接通过监听收消息线程,获取好友列表,就不通过接收广播了
ClientInputThread in = GetMsgService.client
.getClientInputThread();
in.setMessageListener(new MessageListener() {
public void Message(TranObject msg) {
// TODO Auto-generated method stub
if (msg != null
&& msg.getType() == TranObjectType.REFRESH) {
list = (List&User&) msg.getObject();//获取到的数据
if (list.size() & 0) {
// System.out.println(&Friend:& + list);
initListViewData(list);//交给写好的方法加工一下
myExAdapter.updata(group);//调用自定义更新的方法
userDB.updateUser(list);// 保存到数据库
protected void onPostExecute(Void result) {
myExAdapter.notifyDataSetChanged();//通知更新了
myListView.onRefreshComplete();//下拉刷新结束
Toast.makeText(FriendListActivity.this, &刷新成功&, 0).show();
}.execute(null);
版权声明:本文为博主原创文章,未经博主允许不得转载。
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:746268次
积分:10757
积分:10757
排名:第591名
原创:159篇
评论:1700条
文章:10篇
阅读:153951
(1)(2)(1)(1)(1)(1)(1)(5)(3)(2)(1)(1)(5)(2)(4)(3)(4)(5)(5)(5)(4)(7)(6)(15)(5)(7)(15)(39)(15)汇聚2000万达人的兴趣社区下载即送20张免费照片冲印
扫码下载App
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(36408)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_081069',
blogTitle:'邮件服务器常见错误报告列表',
blogAbstract:'邮件服务器400错误报告
Q:421 Server too busyA:因为收件方服务器问题无法连接,这是收件方服务器的SMTP session Full或者是因为收件方服务器 Traffic 无法进行新的 SMTP 连接。请过一会儿重新发送,如继续发生错误时向收件方管理员咨询。
Q:421-Microsoft ESMTP MAIL Service, Version: 5.0. ready at Service not available, closing transmission channelA:收件方的 Microsoft ESMTP 服务器无法正常工作引起的发送失败.请过一会儿重新发送,如继续发生错误时向收件方管理员咨询。
Q:421 4.3.1 ILLEGAL FROM &',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:5,
permalink:'blog/static/',
commentCount:1,
mainCommentCount:1,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'0',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}我是女生,想在QQ上创一个兴趣部落,什么部落可能会受欢迎(尽量不要重复),帮我想想,谢谢_百度知道
我是女生,想在QQ上创一个兴趣部落,什么部落可能会受欢迎(尽量不要重复),帮我想想,谢谢
我有更好的答案
就叫性趣部落 简单大方 绝对都喜欢
你自己偶像的
太有人气了
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 myname 的文章

 

随机推荐