Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to show a custom dialog in Android SDK 14 (ICS)
    primarykey
    data
    text
    <p>So I'm making my first Android app, using ADT in Eclipse and working with SDK Version 14 (ICS), and I'm trying to create a dialog when the user clicks on an ImageButton, but nothing appears to be happening. I've researched the documentation and searched for online tutorials but there isn't much out there yet for SDK rev 14. Do I need to use FragmentManager? I couldn't figure out how to use that, but as far as I can tell the old dialog method should work fine. </p> <p>Here is the relevant code (I think)...</p> <p>Main Activity.java:</p> <pre><code>ImageButton voiceBlock = (ImageButton) findViewById(R.id.voice_block); voiceBlock.setOnClickListener(new OnClickListener() { public void onClick(View v) { Dialog dialog = new Dialog(getBaseContext()); dialog.setContentView(R.layout.dialogue); dialog.setCancelable(true); ImageView voice = (ImageView) dialog.findViewById(R.id.InfoText); //info is a variable referencing an info image which changes on what is in the app voice.setImageResource(info); dialog.show(); } }); </code></pre> <p>dialogue.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;ImageView android:src="@drawable/coin_text" android:id="@+id/InfoText" android:layout_width="300px" android:layout_height="200px" &gt; &lt;/ImageView&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Does anyone know what's going on?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload