>>underlying Activity (which has life cycle implications for the
>>underlying Activity).

Precisely why you would want to use an Activity.

And a Dialog is in no way restricted in it's layout. You can put in any
component inside it, and access it as well. Moreover, dialogs don't have the
same lifecycle events as the activity. Dialogs can be basically used for
providing confirmation messages, prompts and also used for taking in small
inputs from the user. All this, of course can be done by using an Activity,
but creating a whole new activity will be an overhead if it's just to
display a confirmation/prompt or asks for 1-3 inputs from the user.


Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com



On Thu, Nov 25, 2010 at 3:45 AM, William Ferguson <william.ferguson.au@
gmail.com> wrote:

> Sorry Kumar, I don't follow either of those points.
>
> I can also use an Activity where ever I want to.
>
> Can you explain to me what the different use is for a Dialog vs an
> Activity?
> AFAICT they are the same except that
>
> a) a Dialog is styled is ensure it does not completely overlay an
> underlying Activity (which has life cycle implications for the
> underlying Activity). But an Activity can eb styled in the same manner
>
> b) a Dialog is extremely restricted in its layout and which of its
> components can be accessed.
>
> So I'm struggling to understand why you would use a Dialog for *any*
> type of customized layout or styling.
>
>
> On Nov 24, 10:38 pm, Kumar Bibek <[email protected]> wrote:
> > Morever, if you create your own dialog, which you want to have your
> custom
> > appearance, you can use it wherever you want in your application.
> >
> > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
> >
> > On Wed, Nov 24, 2010 at 6:04 PM, William Ferguson <william.ferguson.au@
> >
> > gmail.com> wrote:
> > > OK, I see how you're doing it now. #requestWindowFeature ..
> > > interesting.
> >
> > > But if you're going to the trouble of creating a subclass of Dialog,
> > > why not create an Activity?
> > > What's the benefit of creating a specific dialog subclass vs an
> > > Activity?
> >
> > > On Nov 24, 5:26 pm, Kumar Bibek <[email protected]> wrote:
> > > > I do it through code.
> >
> > > >  requestWindowFeature(Window.FEATURE_NO_TITLE);
> > > >  setContentView(R.layout.confirm_dialog);
> >
> > > > Here, the layout file contains the title. And then you can override
> the
> > > > Dialog's setTitle and setMessage methods, to update your own text
> views
> > > in
> > > > the layout.
> >
> > > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
> >
> > > > On Wed, Nov 24, 2010 at 12:53 PM, William Ferguson <
> william.ferguson.au@
> >
> > > > gmail.com> wrote:
> > > > > That sounds great. How?
> > > > > I would normally turn the title off on an Actiivty by setting
> > > > >   <item name="android:windowNoTitle">true</item>
> > > > > in the style for the Activity. How do I do that for a Dialog?
> >
> > > > > On Nov 24, 3:28 pm, Kumar Bibek <[email protected]> wrote:
> > > > > > You can set the dialog not to have a title(just like turning the
> > > > > Activity's
> > > > > > title off), and then make your layout have a title bar of your
> > > choice. I
> > > > > > normally extend the Dialog class and create my own.
> >
> > > > > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
> >
> > > > > > On Wed, Nov 24, 2010 at 7:38 AM, William Ferguson <
> > > william.ferguson.au@
> >
> > > > > > gmail.com> wrote:
> > > > > > > Its clearly easy to do, because some many apps do it, but I
> can't
> > > see
> > > > > > > how.
> > > > > > > I want to display a very simple dialog, with a Title and
> Content
> > > > > > > (eother TextView or perhaps a WebView).
> >
> > > > > > > But I want to style the dialog so that the background of the
> Title,
> > > > > > > Content and the dialog window itself are something other than
> grey.
> >
> > > > > > > I've tried constructing a Dialog and setting the ContentView
> and
> > > > > > > Title, but the title always has the grey background.
> >
> > > > > > > I've tried using an AlterDialog#Builder, but if I specify the
> title
> > > > > > > string using #setTilte then I have no control over the
> background.
> > > ie
> > > > > > > same as for new Dialog above. I also get the grey background of
> the
> > > > > > > dialog window bleeding through above and below the title and
> > > content.
> >
> > > > > > > I have tried setting a theme for the application that sets the
> > > dialog
> > > > > > > styles using
> > > > > > >        <item name="android:alertDialogStyle">@style/
> > > > > > > myAlertDialogStyle</item>
> > > > > > > But that doesn't seem to have any effect. Buut then again the
> doco
> > > > > > > that I have found is extremely vague on details, so I probably
> > > messed
> > > > > > > it up. If you can point me to some clean and coherent doco I'd
> be
> > > > > > > obliged.
> >
> > > > > > > The closest I have come is to construct using
> AlterDialog#Builder
> > > and
> > > > > > > use both #setContentView and #setCustomTitle as I can style
> eahc of
> > > > > > > those views, but I still have the grey dialog background
> bleeding
> > > > > > > through.above and below the title and content.
> >
> > > > > > > Unless someone can point me in the right direction, the only
> option
> > > I
> > > > > > > can see is to ditch the Dialog altogether and just create an
> > > Activity
> > > > > > > that displays the info I want with the styling I want. This is
> > > > > > > trivial, but it feels SO wrong. If you can't easily style,
> what's
> > > the
> > > > > > > point of the dialogs at all?
> >
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the
> Google
> > > > > > > Groups "Android Developers" group.
> > > > > > > To post to this group, send email to
> > > > > [email protected]
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> > > <android-developers%[email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> >
> > > > > <android-developers%[email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> > > <android-developers%[email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> >
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to
> > > [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> > > <android-developers%[email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> >
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%[email protected]>
> <android-developers%[email protected]<android-developers%[email protected]>
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> >
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to