Custom AlertDialog - problem with android.R.id.custom
<p>I'm sure I'm missing the point here so I'm hoping someone can explain.</p>

<p>I want to create a popup when a user touches an ImageView. I had a look at AlertDialog and the docs say...</p>

<blockquote>
  <p>If you want to display a more complex view, look up the FrameLayout called "custom" and add your view to it:</p>
</blockquote>

<p>...with the following code...</p>

<pre><code>    FrameLayout fl = (FrameLayout) findViewById(android.R.id.custom);
    fl.addView(myView, new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
</code></pre>

<p>So as a test I tried the following in my onCLick() method...</p>

<pre><code>    TextView tv = new TextView(this);
    tv.setText("Hello World");
    FrameLayout customFrameLayout = (FrameLayout) findViewById(android.R.id.custom);
    customFrameLayout.addView(tv, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
</code></pre>

<p>The last line of the above where I'm calling addView() throws a NullPointerException which makes me think there's a problem with android.R.id.custom.</p>

<p>So the question is, what is wrong with the above and also is there a better way of creating a custom popup (perhaps by using the Dialog class or extending it)?</p>

<p>NOTE: I'm only using TextView in this example as a test, I want to add something more complex for my actual popup.</p>
