ComponentName

来源:互联网 发布:淘宝开店卖虚拟 编辑:程序博客网 时间:2024/05/21 22:47

ComponentName(组件名称)是用来打开其他应用程序中的Activity或服务的。

Identifier for a specific application component (ActivityServiceBroadcastReceiver, or ContentProvider) that is available. Two pieces of information, encapsulated here, are required to identify a component: the package (a String) it exists in, and the class (a String) name inside of that package.

用法:

    ComponentName cn=new ComponentName("com.example.myapp", "com.example.myapp.MainActivity");  
    Intent intent = new Intent();  
    intent.setComponent(cn); 
    startActivityForResult(intent,1); 

0 0
原创粉丝点击