总结:
面试是一个不断学习、不断自我提升的过程,有机会还是出去面面,至少能想到查漏补缺效果,而且有些知识点,可能你自以为知道,但让你说,并不一定能说得很好。
有些东西有压力才有动力,而学到的知识点,都是钱(因为技术人员大部分情况是根据你的能力来定级、来发薪水的),技多不压身。
附上我的面试各大专题整理: 面试指南,满满的都是干货,希望对大家有帮助!
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
return parameter1 + parameter2;
}
}
/**
- 作者:叶应是叶
- 时间:2018/3/23 21:13
- 描述:https://github.com/leavesC
*/
public class IComputeImpl extends ICompute.Stub {
@Override
public int subtraction(int parameter1, int parameter2) throws RemoteException {
return parameter1 - parameter2;
}
}
之后就是来创建那唯一的一个 Service 了。Service 直接返回的是 BinderPoolImpl 对象,而 BinderPoolImpl 对象的 queryBinder 可以根据传入的参数再返回对应的 Binder 对象,即进行中转转发,从而使客户端得到真实想要的 Binder 对象
/**
- 作者:叶应是叶
- 时间:2018/3/23 21:55
- 描述:https://github.com/leavesC
*/
public class BinderPoolService extends Service {
private class BinderPoolImpl extends IBinderPool.Stub {
@Override
public IBinder queryBinder(int binderId) {
switch (binderId) {
case 100: {
return new IOperationImpl();
}
case 200: {
return new IComputeImpl();
}
}
return null;
}
}
private Binder binderPool;
public BinderPoolService() {
binderPool = new BinderPoolImpl();
}
@Override
public IBinder onBind(Intent intent) {
return binderPool;
}
}
三、客户端
本客户端请求服务端进行加法操作,因此需要把 IOperation.aidl 文件和 IBinderPool.aidl 文件拷贝过来
与服务端的绑定操作与之前的文章介绍的 AIDL 机制大致相同,区别只在于在 onServiceConnected 中需要调用 queryBinder 方法获取真实的 Binder 对象
/**
- 作者:叶应是叶
- 时间:2018/3/23 22:32
- 描述:https://github.com/leavesC
*/
public class MainActivity extends AppCompatActivity {
private IOperation operation;
private ServiceConnection serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
try {
IBinderPool binderPool = IBinderPool.Stub.asInterface(service);
//本客户端的唯一标识是 100
//获取真实的 Binder 对象
operation = IOperation.Stub.asInterface(binderPool.queryBinder(100));
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
operation = null;
bindService();
}
};
private static final String TAG = “MainActivity”;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bindService();
findViewById(R.id.btn_add).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (operation != null) {
try {
Log.e(TAG, “4+2 加法:” + operation.add(4, 2));
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
if (operation != null) {
unbindService(serviceConnection);
}
}
private void bindService() {
Intent intent = new Intent();
intent.setClassName(“com.czy.binder_pool_server”, “com.czy.binder_pool_server.BinderPoolService”);
结尾
最后,针对上面谈的内容,给大家推荐一个Android资料,应该对大家有用。
首先是一个知识清单:(对于现在的Android及移动互联网来说,我们需要掌握的技术)
泛型原理丶反射原理丶Java虚拟机原理丶线程池原理丶
注解原理丶注解原理丶序列化
Activity知识体系(Activity的生命周期丶Activity的任务栈丶Activity的启动模式丶View源码丶Fragment内核相关丶service原理等)
代码框架结构优化(数据结构丶排序算法丶设计模式)
APP性能优化(用户体验优化丶适配丶代码调优)
热修复丶热升级丶Hook技术丶IOC架构设计
NDK(c编程丶C++丶JNI丶LINUX)
如何提高开发效率?
MVC丶MVP丶MVVM
微信小程序
Hybrid
Flutter
接下来是资料清单:(敲黑板!!!)
1.数据结构和算法
2.设计模式
3.全套体系化高级架构视频;七大主流技术模块,视频+源码+笔记
4.面试专题资料包(怎么能少了一份全面的面试题总结呢~)
不论遇到什么困难,都不应该成为我们放弃的理由!共勉~
如果你看到了这里,觉得文章写得不错就给个赞呗?如果你觉得那里值得改进的,请给我留言。一定会认真查询,修正不足。谢谢。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!