Skip to content Skip to sidebar Skip to footer

Fatal Exception: Main Java.lang.runtimeexception: Unable To Start Activity A Lot Of Bug

I added scrollview in my activity_main.xml and its not working anymore. Before scrollview it did not work on Samsung s3,s4. But it worked on other phones and tablets. 02-15 05:37:3

Solution 1:

You've got this error in setContentView(R.layout.activity_main); and its because of memory problems. It seems you've used a big image. You must scale down your image.

Solution 2:

Change

setContentView(R.layout.activity_main);

to

View_mw= getLayoutInflater().inflate(R.layout.activity_main, null);
setContentView(_mw);

Solution 3:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.kushagra.dynamiclist, PID: 2456 android.view.InflateException: Binary XML file line #9: Error inflating class unknown

Got the same issue, wasted my day trying to find the problem. My app worked well in both emulator and real device for phones but crashed while using tablets or the ones with larger screen. I also tried increasing my memory heap but that didn't help. The listview I had been using had android:background="@drawable/edittextborder" which was the source of the crash. Didn't know why or how but removing that solved the issue for me.

<LinearLayoutandroid:background="@drawable/edittextborder"android:layout_margin="5dp"android:id="@+id/allListData"android:padding="10dp"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><ImageViewandroid:id="@+id/logo"android:layout_width="30dp"android:layout_height="30dp" /><TextViewandroid:paddingLeft="10dp"android:id="@+id/listName"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Hello"/></LinearLayout>

Post a Comment for "Fatal Exception: Main Java.lang.runtimeexception: Unable To Start Activity A Lot Of Bug"