私の問題は、TabActivity の 1 つのタブの下に複数のアクティビティがあることですが、その時点で 1 つのアクティビティから別のアクティビティに 3 回以上移動すると、「java.lang.StackOverflowError」が発生して申し訳ありません。英語でのコミュニケーション。
どんな助けでも大歓迎です。
私のコードは: -
FirstActivity.java
public class FirstActivity extends ActivityGroup implements
OnClickListener {
Button mBtnAdd;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.screen1);
mBtnAdd = (Button) findViewById(R.id.mBtnAddManageAccount);
mBtnAdd.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (v == mBtnAdd) {
Intent mInSecond = new Intent(v.getContext(), SecondActivity.class);
replaceContentView("SecondActivity", mInSecond);
}
}
public void replaceContentView(String id, Intent newIntent) {
View view = getLocalActivityManager().startActivity(id,
newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
this.setContentView(view);
}
}
SecondActivity.java
public class SecondActivity extends ActivityGroup implements
OnClickListener {
Button mBtnBack;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.screen2);
mBtnBack=(Button)findViewById(R.id.mBtnBackNewCustomer);
mBtnBack.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v==mBtnBack){
Intent mInBack = new Intent(v.getContext(),
FirstActivity.class);
replaceContentView("FirstActivity", mInBack);
}
}
public void replaceContentView(String id, Intent newIntent) {
View view = getLocalActivityManager().startActivity(id,
newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
this.setContentView(view);
}
}
エラー ログキャット:-
07-19 11:02:01.731: E/AndroidRuntime(528): FATAL EXCEPTION: main
07-19 11:02:01.731: E/AndroidRuntime(528): java.lang.StackOverflowError
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6986)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.ScrollView.draw(ScrollView.java:1409)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.View.draw(View.java:6883)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.widget.FrameLayout.draw(FrameLayout.java:357)
07-19 11:02:01.731: E/AndroidRuntime(528): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewRoot.draw(ViewRoot.java:1522)
07-19 11:02:01.731: E/AndroidRuntime(528): at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
07-19 11:02:01.731: E/AndroidRuntime(528): a