我想知道android中的getSystemService()方法是怎么工作的。
举个例子(含有疑问):
Android中的Vibrator类。获取实例:Vibrator mvibrator=(Vibrator)getSystemService(VIBRATOR_SERVICE); 不是通过new获得实例这我知道,因为Vibrator是一个抽象类。
但(Vibrator)getSystemService(VIBRATOR_SERVICE);又是怎么做到的?android抽象类
举个例子(含有疑问):
Android中的Vibrator类。获取实例:Vibrator mvibrator=(Vibrator)getSystemService(VIBRATOR_SERVICE); 不是通过new获得实例这我知道,因为Vibrator是一个抽象类。
但(Vibrator)getSystemService(VIBRATOR_SERVICE);又是怎么做到的?android抽象类
他们的工作方式都是利用Binder间进程通信,因为系统服务都运行在框架进程中system_process中,启动后系统服务都注册到框架进程并跑在单独的线程里面。