androidandroid-emulatormobile-emulator

this program failed to install on emulator or mobile phone. why?


I write the program and i try to run the program but this program have 2warning :( and when i try to run with emulator, the program is failed. when i run with mobile phone, mobile was hang, even with disconnected mobile with pc, mobile is still hanging:(

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@color/background"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="30dip"
    android:orientation="horizontal">
    <LinearLayout
        android:orientation="vertical"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_gravity="center">
        <TextView
            android:text="@string/main_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:layout_marginBottom="25dip"
            android:textSize="24.5sp"/>
        <Button
            android:id="@+id/continue_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/continue_label"/>
        <Button
            android:id="@+id/new_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/new_game_label"/>
        <Button
            android:id="@+id/about_button"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/about_label" />
        <Button 
        android:id="@+id/exit_button"
    android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/exit_label"/>
  </LinearLayout>


strings.xml

 <resources>
  <string name="app_name">Sudoku</string>
  <string name="menu_settings">Menue</string>
  <string name="title_activity_main">MianActivity</string>
  <string name="main_title">Android Sudoku</string>
  <string name="continue_label">Continue</string>
  <string name="new_game_label">New Game</string>
  <string name="about_label">About</string>
  <string name="exit_label">Exit</string>

 </resources>

annd AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.example.sudoku"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

and warning errors are: of line 9 --> This LinearLayout layout or its LinearLayout parent is useless; transfer the background attribute to the other view

of line 13 --> Unexpected text found in layout file: """


Solution

  • You dont need a nested LinearLayout Here. Because there are no other children to the first LinearLayout. Remove the first LinearLayout. It is useless.