事务太大异常android
我有一个向fragment打开的活动,两个片段都包含单选组,单选组包含可绘制图像作为按钮。当活动打开时,返回到上一个活动,并说事务太大异常。t此异常说明它没有正确加载可绘制单选按钮 爪哇的住宅和商业活动:事务太大异常android,android,xml,Android,Xml,我有一个向fragment打开的活动,两个片段都包含单选组,单选组包含可绘制图像作为按钮。当活动打开时,返回到上一个活动,并说事务太大异常。t此异常说明它没有正确加载可绘制单选按钮 爪哇的住宅和商业活动: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_reside
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_residential__commercial_);
Firstopenfragment();
SetToolbar();
TypeCasting();
//FOR BACK BUTTON ENABLED
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mNextActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//get data from map activity and also from this activity which button is clicked in the form of string and pass previous data and this activity data to next activity which is "Upload_Property_Activity"
Intent next = new Intent(Residential_Commercial_Activity.this, Upload_Property_Activity.class);
startActivity(next);
}
});
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RelativeLayout rl = (RelativeLayout) findViewById(R.id.Replace);
if (checkedId == R.id.Commercial) {
//calling fragment Builder_Broker_Fragment
CommercialFragment frag = new CommercialFragment();
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.Replace, frag, "Commercial");
// transaction.replace(R.id.frag1,frag);
transaction.commit();
Toast.makeText(getApplication(), "clicked", Toast.LENGTH_SHORT).show();
} else if (checkedId == R.id.Residential) {
ResidentialFragment frag = new ResidentialFragment();
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.Replace, frag, "Residential");
transaction.commit();
}
}
});
}
private void Firstopenfragment() {
ResidentialFragment frag = new ResidentialFragment();
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.replace(R.id.Replace, frag, "Residential");
transaction.commit();
}
住宅和商业xml:
我想打开的片段是:“Transnsaction太大异常(android上)”——这不是堆栈跟踪中显示的异常。堆栈跟踪显示一个
堆栈溢出错误
。我猜您已经创建了一个引用自身的StateListDrawable
资源。@不管怎样,我怀疑是否会出现这样的异常。。。至少,我希望如此。编辑标题,所以至少没有打字。@普通SWALARE意思是……@ ShehzadKhan,我不确定“意味着……”代表“什么意思?”或诸如此类,但请考虑完整句子。“通用SWASE我问什么是状态LSET抽屉,我如何解决这个问题?”--这不是堆栈跟踪中显示的异常。堆栈跟踪显示一个堆栈溢出错误
。我猜您已经创建了一个引用自身的StateListDrawable
资源。@不管怎样,我怀疑是否会出现这样的异常。。。至少,我希望如此。编辑标题,所以至少没有打字。@普通SWALARE意思是……@ ShehzadKhan,我不确定“意味着……”代表“哪种意思?”或诸如此类,但请考虑完整句子。
<include
android:id="@+id/app_bar"
layout="@layout/appbartransparent"></include>
<ImageView
android:id="@+id/Backgroundimage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop"
android:src="@mipmap/background" />
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#2E7D32"
android:text="Next"
android:layout_gravity="bottom"
android:id="@+id/NextActivity" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:background="#FFFFFF"
android:orientation="vertical"
android:layout_marginBottom="60dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="90dp"
android:layout_marginStart="90dp"
android:layout_marginTop="20dp">
<ImageView
android:layout_width="150dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:background="@drawable/residential" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:text="@string/Gotit"
android:textSize="23dp" />
<RadioGroup
android:id="@+id/RadioButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:checkedButton="@+id/first"
android:orientation="horizontal"
android:weightSum="1">
<RadioButton
android:id="@+id/Residential"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/for_sell"
android:checked="false"
android:button="@null"/>
<RadioButton
android:id="@+id/Commercial"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/Residential"
android:background="@drawable/commercialdrawable"
android:button="@null"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
</RadioGroup>
<RelativeLayout
android:id="@+id/Replace"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp">
</RelativeLayout>
</LinearLayout>
</FrameLayout>
<fragment
android:id="@+id/fragment_navigation1"
android:name="com.example.asad.homebuyerproject.NavigationBar"
android:layout_width="@dimen/navigationdrawerwidth"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="@layout/fragment_navigation"
tools:layout="@layout/fragment_navigation" />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
tools:context="com.example.asad.homebuyerproject.ResidentialFragment">
<RadioGroup
android:id="@+id/ReplaceAreaCommercial"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="#FFFFFF">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/hosteldrawable"
android:button="@null" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/Residential"
android:background="@drawable/housedrawable"
android:button="@null" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/Residential"
android:background="@drawable/builderfloor"
android:button="@null" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/Residential"
android:background="@drawable/penthousedrawable"
android:button="@null" />
</RadioGroup>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="150dp"
android:layout_marginStart="150dp"
>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/flatdrawable"
android:button="@null" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/villadrawable"
android:button="@null"
/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/studioaprtment"
android:button="@null" />
</RadioGroup>
</RelativeLayout>
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.asad.homebuyerproject, PID: 4082
java.lang.StackOverflowError: stack size 8MB
at android.content.res.XmlBlock.newParser(XmlBlock.java:71)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2672)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2467)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawa
I/art: WaitForGcToComplete blocked for 26.116ms for cause Alloc
I/art: WaitForGcToComplete blocked for 25.978ms for cause Alloc
I/art: WaitForGcToComplete blocked for 25.225ms for cause Alloc
I/art: WaitForGcToComplete blocked for 25.021ms for cause Alloc
D/Error: ERR: exClass=java.lang.StackOverflowError
D/Error: ERR: exMsg=stack size 8MB
D/Error: ERR: file=XmlBlock.java
D/Error: ERR: class=android.content.res.XmlBlock
D/Error: ERR: method=newParser line=71
I/art: Background sticky concurrent mark sweep GC freed 2(800KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 91MB/92MB, paused 7.924ms total 10.023ms
I/art: Alloc partial concurrent mark sweep GC freed 34(2608B) AllocSpace objects, 1(21MB) LOS objects, 18% free, 70MB/86MB, paused 206us total 22.998ms
D/Error: ERR: stack=java.lang.StackOverflowError: stack size 8MB
at android.content.res.XmlBlock.newParser(XmlBlock.java:71)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2672)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2467)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2469)
at android.content.res.Resources.loadDrawable(Resources.java:2381)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.graphics.drawable.StateListDrawable.inflateChildElements(StateListDrawable.java:182)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:127)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1128)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1032)
at android.content.res.Resources.loadDrawableForCookie(Res
D/Error: ERR: TOTAL BYTES WRITTEN: 15842836
E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!
E/AndroidRuntime: Error reporting crash
android.os.TransactionTooLargeException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:496)
Application terminated.