0

I am having this error in this code:

Unable to start activity UomponentInfo {com.example.ilovemii.myapplicationblue/com.example.ilovemii.myapplicationblue.hotlifebluetoothspp}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features

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

my hotlifebluetoothspp.java code

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;
        }
    }

this is my 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>

Thanks a lot!!

ericsson
  • 15
  • 4
  • The actual error message is right after the log you posted - we'd need to see the `Caused by` line – ianhanniballake Aug 18 '16 at 02:30
  • "hotlifebluetoothspp.java:81" This means the error occurs at line 81 in hotlifebluetoothspp.java. Which line is this? – Code-Apprentice Aug 18 '16 at 02:34
  • Not related to your error: You have the line `mTitle = (TextView) findViewById(R.id.title_left_text);` twice. There is no need for the duplication. – Code-Apprentice Aug 18 '16 at 02:35
  • @ianhanniballake `Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features` – ericsson Aug 18 '16 at 03:27
  • @Code-Apprentice `setContentView(R.layout.hotlife_bluset);` – ericsson Aug 18 '16 at 03:36
  • If the linked question at the top of this page doesn't help you, please edit this to explain what you have tried and how your situation differs from the linked question. Also, be sure to include the `hotlife_bluset.xml` layout. – Code-Apprentice Aug 18 '16 at 18:04

0 Answers0