我正在尝试做一个按钮,而不是它的功能是转到 TabWidget 中的上一个活动
btnVolver.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0)
{
String className = getIntent().getStringExtra("webpush");
Class<?> webpushClass = null;
try {
webpushClass = Class.forName(className);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent intent = new Intent(getApplicationContext(), webpushClass);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// webPushActivity.this.finishActivity(RESULT_OK);
View vista = getLocalActivityManager().startActivity("prueba",
intent)
.getDecorView();
setContentView(vista);
A--> 实际活动。B--> 上一个活动
但是当我从 A 到 B,从 B 到 A,从 A 到 B(第三次点击)时,我得到下一个错误:
06-20 09:23:20.256: E/AndroidRuntime(554): FATAL EXCEPTION: main
06-20 09:23:20.256: E/AndroidRuntime(554):
java.lang.StackOverflowError
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.text.Styled.measureText(Styled.java:430)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.text.Layout.measureText(Layout.java:1655)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.text.Layout.getLineMax(Layout.java:689)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.text.Layout.draw(Layout.java:340)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.text.BoringLayout.draw(BoringLayout.java:365)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.TextView.onDraw(TextView.java:4050)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6740)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1638)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.drawChild(ViewGroup.java:1640)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.View.draw(View.java:6743)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.widget.FrameLayout.draw(FrameLayout.java:352)
06-20 09:23:20.256: E/AndroidRuntime(554): at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1842)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewRoot.draw(ViewRoot.java:1407)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
06-20 09:23:20.256: E/AndroidRuntime(554): at
android.os.Handler.dispatchMess
谢谢