I have two text images in action defined by xml - both with a gray background color. In my application, I set one of the background colors of the textviews to blue. This works as expected.
BUT: When I rotate the device (rotate) or leave the application and return again, the other text image is also blue - the same color as the one that was intentionally installed ...!?
When I leave the application and start it again, the second text remains blue. When I stop the application from starting (kill) and start it again, the second text appears gray. But the same problem occurs as soon as I rotate the device or launch the application the next time.
Faulty device working 4.1.1. - The same application on 2.3.4 works without problems.
SDK Tools 22.0.1, Eclipse Juno Service Release 2 32 bit, Windows 7 64 bit
EDIT: Same issue for SDK Tools 14, Eclipse Indigo SR1 32 bit on Windows 7 32 bit
I have no idea what is going on there. This is a kind of unwanted magic. Could you help me?


Below is the actual source code without any changes from the problematic project.
MainActivity.java:
package com.example.test; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv1 = (TextView) findViewById(R.id.textView1); tv1.setBackgroundColor(0xff33b5e5); } }
acitivity_main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="100dp" android:background="#cccccc" /> <TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="100dp" android:layout_marginTop="20dp" android:background="#cccccc" /> </LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.test" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:icon="@drawable/ic_launcher" android:label="TextView Test" > <activity android:name="com.example.test.MainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
EDIT 2: To make things even weirder: if I change the color of textview2 a bit to ie #cdcdcd, the problem will not appear. Only if both colors (textview1 and textview2) are identical in XML.