0

Possible Duplicate:
Android Activity as a dialog

I have a little problem with an intent that call an Activity that show a chart. I want to show the activity in a new Dialog, how can I make it?

this is the code that call the Activity:

    Intent intent = ChartFactory.getBarChartIntent(
            chartproject.this, buildBarDataset(titles, values),
            renderer, Type.STACKED);    
    chartproject.this.startActivity(intent);
Community
  • 1
  • 1
Pablo
  • 9
  • 3
  • You might find your answer here - http://stackoverflow.com/questions/1979369/android-activity-as-a-dialog – Suchi Jul 05 '11 at 16:19

1 Answers1

0

You only need to make change in AndroidManifest.xml as shown below,

<activity android:name=".className"
              android:label="Choose Category..."
              android:windowSoftInputMode="stateAlwaysVisible|adjustPan"  
                android:theme="@android:style/Theme.Dialog">   </activity>

where,

className: main class name of activity that you want to show in dialog.

that's it. you will have your activity as dialog.

user609239
  • 3,356
  • 5
  • 25
  • 26
  • it works, thanks :) but now... How add a button to the dialog? – Pablo Jul 05 '11 at 17:43
  • Create new xml file for the layout of activity. place the button on that xml. In setContentView() method of a class, use this xml file. By the way i can help you in learning android. – user609239 Jul 05 '11 at 19:04
  • @user609239 This only works if your activity extend Activity. How can you achieve this effect if you extends ActionBarActivity? In my case I cant extend Activity. The whole framework is build on top of ActionBarActivity... No way to extend Activity. – 5er Nov 14 '14 at 13:01