ComponentName知识
生活随笔
收集整理的這篇文章主要介紹了
ComponentName知识
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
以下是ComponentName的API
/*** Create a new component identifier from a Context and Class object.* * @param pkg A Context for the package implementing the component, from* which the actual package name will be retrieved.* @param cls The Class object of the desired component, from which the* actual class name will be retrieved.*/public ComponentName(Context pkg, Class<?> cls) {mPackage = pkg.getPackageName();mClass = cls.getName();}
ComponentName(組件名稱)可以用來打開其他應用程序中的Activity或服務。
Intent it=new Intent(); it.setComponent(new ComponentName(String packageName,String activityName )); startActivity(it);
總結
以上是生活随笔為你收集整理的ComponentName知识的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 学成在线--13.RabbitMQ工作模
- 下一篇: mysql 1130 localhost