I get an exception every time I launch the application. Here is the stacktrace for the exception
10-01 14:49:35.321: WARN/WindowManager(61): Exception when adding starting window
10-01 14:49:35.321: WARN/WindowManager(61): java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_height attribute.
10-01 14:49:35.321: WARN/WindowManager(61): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:438)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3468)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:3547)
10-01 14:49:35.321: WARN/WindowManager(61): at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1265)
10-01 14:49:35.321: WARN/WindowManager(61): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1191)
10-01 14:49:35.321: WARN/WindowManager(61): at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
10-01 14:49:35.321: WARN/WindowManager(61): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2153)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2207)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1395)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:818)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.server.WindowManagerService$H.handleMessage(WindowManagerService.java:8794)
10-01 14:49:35.321: WARN/WindowManager(61): at android.os.Handler.dispatchMessage(Handler.java:99)
10-01 14:49:35.321: WARN/WindowManager(61): at android.os.Looper.loop(Looper.java:123)
10-01 14:49:35.321: WARN/WindowManager(61): at com.android.server.WindowManagerService$WMThread.run(WindowManagerService.java:531)
I am also posting the XML file I'm using.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/arw_layout" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:id="@+id/arw_logo" android:layout_width="30px"
android:layout_height="40px" android:layout_alignParentRight="true" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center"
android:layout_alignParentLeft="true">
<TextView android:id="@+id/arw_left" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/arw_left"
android:textSize="25sp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:gravity="center_vertical" />
<TextView android:id="@+id/arw_title" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:minEms="10"
android:text="@string/arw_title" android:paddingLeft="10dp"
android:paddingRight="10dp" android:gravity="center" />
<TextView android:id="@+id/arw_right" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/arw_right"
android:textSize="25sp" android:paddingLeft="10dp"
android:paddingRight="10dp" android:gravity="center_vertical" />
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#FF493538"
android:centerColor="#FF000000"
android:endColor="#FF000000"
android:angle="270" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="Gallery1">
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="WindowTitleBackground" parent="android:WindowTitleBackground">
<item name="android:background">@drawable/gradient</item>
</style>
</resources>
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="titletheme">
<item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground
</item>
</style>
</resources>
How Exceptions Work in JVM and Android. In Java, all exception and error types are subclasses of Throwable. The Throwable class changes the execution flow of JVM apps by throwing exceptions and deciding how to recover from an error. Adding an exception to a code changes its execution flow.
In computing, a fatal exception error or fatal error is an error that causes a program to abort and may therefore return the user to the operating system.
XML stands for eXtensible Markup Language, which is a way of describing data using a text-based document. Because XML is extensible and very flexible, it's used for many different things, including defining the UI layout of Android apps.
I found the solution. I added the parent attribute parent="android:Theme" to my custom style, titletheme and it solved the problem.
Thanks for your replies
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With