您的位置:首页 > 移动开发 > Android开发

android_不显示界面的activity调用

2014-10-16 21:28 309 查看
1.程序A调用程序B

2.程序A:

ComponentName componetName = new ComponentName(
//package
"pers.phoenix.factory",
//activity
"pers.phoenix.factory.AccountActivity");
Intent intent= new Intent();
Bundle bundle = new Bundle();
bundle.putString("action", "test");
intent.putExtras(bundle);
intent.setComponent(componetName);
startActivity(intent);

3.程序B的AndroidManifest.xml:
<activity
android:name="pers.phoenix.factory.AccountActivity"
android:theme="@android:style/Theme.NoDisplay" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>

4.程序B的代码:
public class AccountActivity extends Activity{
private static final String TAG = AccountActivity.class.getSimpleName();

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);

Intent intent= getIntent();
String value=intent.getStringExtra("action");
Log.i(TAG, "parameter--------> " + value); //余下省略......
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android
相关文章推荐