title: Android transparent layout
body: <p>I'm very new to Android. I want to pop up a transparent screen when the user receives a call. I have this code to open up the MyActivity screen, but it's white instead of transparent.</p>
  
  <pre><code>public class CallReceiver extends BroadcastReceiver {
  
    @Override
    public void onReceive(Context context, Intent intent) {
      String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
      if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)) {
        SystemClock.sleep(1);
        Intent intent = new Intent(context, MyActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_USER_ACTION);
        context.startActivity(intent);
      }
  
    }
  
  }
  </code></pre>
  
  <p>Here's the code for MyActivity:</p>
  
  <pre><code>public class MyActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_my);
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
      getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
    }
  }
  </code></pre>
  
  <p>And here's the layout:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:windowBackground="@android:color/transparent" 
      android:windowIsTranslucent="true" 
      android:windowAnimationStyle="@android:style/Animation.Translucent" &gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:text="@string/incoming_call"
          tools:context=".MyActivity" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This successfully pops up a screen with my message on it, but it does so with a white background instead of a transparent background. Any idea what I might be doing wrong? I'm using the emulator with the Android 2.2 SDK.</p>