return date;
}
public void setDate(String date) {
this.date = date;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
/Contact_Demo/src/com/suntek/contact/adapter/DialAdapter.java
package com.suntek.contact.adapter;
import java.util.List;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.suntek.contact.R;
import com.suntek.contact.model.CallLogBean;
/**
-
电话记录适配器
-
@author Administrator
*/
public class DialAdapter extends BaseAdapter {
private Context ctx;
private List callLogs;
private LayoutInflater inflater;
public DialAdapter(Context context, List callLogs) {
this.ctx = context;
this.callLogs = callLogs;
this.inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return callLogs.size();
}
@Override
public Object getItem(int position) {
return callLogs.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.contact_record_list_item,
null);
holder = new ViewHolder();
holder.call_type = (ImageView) convertView
.findViewById(R.id.call_type);
holder.name = (TextView) convertView.findViewById(R.id.name);
holder.number = (TextView) convertView.findViewById(R.id.number);
holder.time = (TextView) convertView.findViewById(R.id.time);
holder.call_btn = (TextView) convertView
.findViewById(R.id.call_btn);
convertView.setTag(holder); // 缓存
} else {
holder = (ViewHolder) convertView.getTag();
}
CallLogBean callLog = callLogs.get(position);
switch (callLog.getType()) {
case 1:
holder.call_type
.setBackgroundResource(R.drawable.ic_calllog_outgoing_nomal);
break;
case 2:
holder.call_type
.setBackgroundResource(R.drawable.ic_calllog_incomming_normal);
break;
case 3:
holder.call_type
.setBackgroundResource(R.drawable.ic_calllog_missed_normal);
break;
}
holder.name.setText(callLog.getName());
holder.number.setText(callLog.getNumber());
holder.time.setText(callLog.getDate());
addViewListener(holder.call_btn, callLog, position);
return convertView;
}
private static class ViewHolder {
ImageView call_type;
TextView name;
TextView number;
TextView time;
TextView call_btn;
}
private void addViewListener(View view, final CallLogBean callLog,
final int position) {
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse(“tel:” + callLog.getNumber());
Intent intent = new Intent(Intent.ACTION_CALL, uri);
ctx.startActivity(intent);
}
});
}
}
/Contact_Demo/src/com/suntek/contact/ContactRecordListActivity.java
package com.suntek.contact;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import android.app.Activity;
import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.CallLog;
import android.widget.ListView;
import com.suntek.contact.adapter.DialAdapter;
import com.suntek.contact.model.CallLogBean;
/**
-
通话记录列表
-
@author wwj
*/
public class ContactRecordListActivity extends Activity {
private ListView callLogListView;
private AsyncQueryHandler asyncQuery;
private DialAdapter adapter;
private List callLogs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contact_record_list_view);
callLogListView = (ListView) findViewById(R.id.call_log_list);
asyncQuery = new MyAsyncQueryHandler(getContentResolver());
init();
}
private void init() {
Uri uri = android.provider.CallLog.Calls.CONTENT_URI;
// 查询的列
String[] projection = { CallLog.Calls.DATE, // 日期
CallLog.Calls.NUMBER, // 号码
CallLog.Calls.TYPE, // 类型
CallLog.Calls.CACHED_NAME, // 名字
CallLog.Calls._ID, // id
};
asyncQuery.startQuery(0, null, uri, projection, null, null,
CallLog.Calls.DEFAULT_SORT_ORDER);
}
private class MyAsyncQueryHandler extends AsyncQueryHandler {
public MyAsyncQueryHandler(ContentResolver cr) {
super(cr);
}
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
if (cursor != null && cursor.getCount() > 0) {
callLogs = new ArrayList();
SimpleDateFormat sfd = new SimpleDateFormat(“MM-dd hh:mm”);
Date date;
cursor.moveToFirst(); // 游标移动到第一项
for (int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
date = new Date(cursor.getLong(cursor
.getColumnIndex(CallLog.Calls.DATE)));
String number = cursor.getString(cursor
.getColumnIndex(CallLog.Calls.NUMBER));
int type = cursor.getInt(cursor
.getColumnIndex(CallLog.Calls.TYPE));
String cachedName = cursor.getString(cursor
.getColumnIndex(CallLog.Calls.CACHED_NAME));// 缓存的名称与电话号码,如果它的存在
int id = cursor.getInt(cursor
.getColumnIndex(CallLog.Calls._ID));
CallLogBean callLogBean = new CallLogBean();
callLogBean.setId(id);
callLogBean.setNumber(number);
callLogBean.setName(cachedName);
if (null == cachedName || “”.equals(cachedName)) {
callLogBean.setName(number);
}
callLogBean.setType(type);
callLogBean.setDate(sfd.format(date));
callLogs.add(callLogBean);
}
if (callLogs.size() > 0) {
setAdapter(callLogs);
}
}
super.onQueryComplete(token, cookie, cursor);
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(资料价值较高,非无偿)
![](https://i-blog.csdnimg.cn/blog_migrate/de06ca74a5a6ddbd7be8601592cd4f9a.jpeg)
文末
好了,今天的分享就到这里,如果你对在面试中遇到的问题,或者刚毕业及工作几年迷茫不知道该如何准备面试并突破现状提升自己,对于自己的未来还不够了解不知道给如何规划,可以来看看同行们都是如何突破现状,怎么学习的,来吸收他们的面试以及工作经验完善自己的之后的面试计划及职业规划。
这里放上一部分我工作以来以及参与过的大大小小的面试收集总结出来的相关的几十套腾讯、头条、阿里、美团等公司21年的面试专题,其中把技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,这里以图片的形式给大家展示一部分免费分享给大家,主要还是希望大家在如今大环境不好的情况下面试能够顺利一点,希望可以帮助到大家~
还有 高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料 帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习。
【Android核心高级技术PDF文档,BAT大厂面试真题解析】
【延伸Android必备知识点】
这里只是整理出来的部分面试题,后续会持续更新,希望通过这些高级面试题能够降低面试Android岗位的门槛,让更多的Android工程师理解Android系统,掌握Android系统。喜欢的话麻烦点击一个喜欢在关注一下~
《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》,点击传送门即可获取!
知识脉络 + 诸多细节*,由于篇幅有限,这里以图片的形式给大家展示一部分免费分享给大家,主要还是希望大家在如今大环境不好的情况下面试能够顺利一点,希望可以帮助到大家~
还有 高级架构技术进阶脑图、Android开发面试专题资料,高级进阶架构资料 帮助大家学习提升进阶,也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习。
【Android核心高级技术PDF文档,BAT大厂面试真题解析】
[外链图片转存中…(img-q1PkyXcJ-1711615777279)]
【延伸Android必备知识点】
[外链图片转存中…(img-HghKcC2f-1711615777280)]
这里只是整理出来的部分面试题,后续会持续更新,希望通过这些高级面试题能够降低面试Android岗位的门槛,让更多的Android工程师理解Android系统,掌握Android系统。喜欢的话麻烦点击一个喜欢在关注一下~