继承baseadapter怎么实现
1个回答
展开全部
1)mListView = (ListView) findViewById(R.id.listView);
mListView.setAdapter(new mListAdapter(this, getdata2()));
//设置Adapter的时候,用this传Context,不要用getApplicationContext()
2)public mListAdapter(Context context, List<HashMap<String, Object>> list) {
this.mContext = context;
this.mHashMaps = list;
}//将Context传入自定义Adapter中
3)private void ShowInfo() {
new AlertDialog.Builder(mContext).setTitle("my listview").setMessage("introduce....").
setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}).show();
}//这样Builder(mContext)就OK了
mListView.setAdapter(new mListAdapter(this, getdata2()));
//设置Adapter的时候,用this传Context,不要用getApplicationContext()
2)public mListAdapter(Context context, List<HashMap<String, Object>> list) {
this.mContext = context;
this.mHashMaps = list;
}//将Context传入自定义Adapter中
3)private void ShowInfo() {
new AlertDialog.Builder(mContext).setTitle("my listview").setMessage("introduce....").
setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}).show();
}//这样Builder(mContext)就OK了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询