---
title: "ActivityGroup 内的activity 启动另一个activity方法"
author: "jguangyou"
date: "2012-04-26T19:04:58Z"
tags: []
categories: ["移动开发"]
slug: "activitygroup-activity-activity"
draft: false
lastmod: "2012-04-26T19:04:58Z"
id: 1500128
url: "https://deep-fish.iteye.com/blog/1500128"
---

```java

RelativeLayout rl = (RelativeLayout) this.getParent().getWindow()
				.findViewById(R.id.datacontainer);
		rl.removeAllViews();
		Intent intent = new Intent(this, NewsDetailsActivity.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		Window sub = ((ActivityGroup) this.getParent())
				.getLocalActivityManager().startActivity("NewsDetailsActivity",
						intent);
		View v = sub.getDecorView();
		LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
				LinearLayout.LayoutParams.FILL_PARENT,
				LinearLayout.LayoutParams.FILL_PARENT);
		v.setLayoutParams(params);
		rl.addView(v);

```