无法启动活动ComponentInfo,我不知道

时间:2016-08-18 02:27:55

标签: android

我在此代码中遇到此错误:

  

无法启动活动UomponentInfo   {com.example.ilovemii.myapplicationblue / com.example.ilovemii.myapplicationblue.hotlifebluetoothspp}:android.util.AndroidRuntimeException:您无法将自定义标题与其他标题功能结合使用

     

at com.example.ilovemii.myapplicationblue.hotlifebluetoothspp.onCreate(hotlifebluetoothspp.java:81)

我的hotlifebluetoothspp.java代码

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(D) Log.e(TAG, "+++ ON CREATE +++");

        // Set up the window layout
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.hotlife_bluset);

        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

        // Set up the custom title
        mTitle = (TextView) findViewById(R.id.title_left_text);
        mTitle.setText(R.string.app_name);
        mTitle = (TextView) findViewById(R.id.title_right_text);
        // Get local Bluetooth adapter

        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        mOutEditText = (EditText) findViewById(R.id.edit01);
        mOutEditText.setInputType(InputType.TYPE_NULL);
        SharedPreferences settings = getSharedPreferences(SETTING_PREF, 0);
        String msg1 = settings.getString(SHARED_send, "");
        if(msg1 == null){
            mOutEditText.setText("R");
        }else{
            mOutEditText.setText(msg1);
        }
        // If the adapter is null, then Bluetooth is not supported
        if (mBluetoothAdapter == null) {
            Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
            finish();
            return;
        }
    }

这是我的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.ilovemii.myapplicationblue"
    android:versionCode="1"
    android:versionName="1.0">
    <uses-sdk android:minSdkVersion="7" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <application android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name">
        <activity android:name=".hotlifebluetoothspp"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboardHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".DeviceListActivity"
            android:label="@string/select_device"
            android:theme="@android:style/Theme.Dialog"
            android:configChanges="orientation|keyboardHidden" />
        <activity android:name=".DeviceListActivity01"
            android:label="@string/select_device"
            android:theme="@android:style/Theme.Dialog"
            android:configChanges="orientation|keyboardHidden" />

    </application>
</manifest>

非常感谢!!

0 个答案:

没有答案