Custom component using custom dialog

by Nigel » Wed, 09 Sep 2009 02:15:28 GMT

Sponsored Links
 My application needs to be aware of a custom dialog, which is used
only by a custom component.  By "aware" I mean through the
onCreateDialog and onPrepareDialog.

I would like the dialog to be fully encapsulated by the component, but
if the component performs a:

Dialog d = new CustomDialog(getContext());;

rather than:

Activity a = (Activity)getContext();

I get an exception - primarily because the dialog's "onCreate(Bundle
b)" method doesn't get automatically called.

I'm looking for opinions on the best way to structure the code...

Comments welcomed.




Custom component using custom dialog

by Nigel » Thu, 10 Sep 2009 13:35:33 GMT

 In the end I have performed this with the client code making an
explicit call to perform the required initialisation.  This doesn't
feel right, but it works.


Sponsored Links

Other Threads

1. How to write a test case for custom MediaPlayer class

I would like to create an instrumented unit test for my
StreamMediaPlayer class which extends the MediaPlayer to be add
support for arbitrary input streams.  I chose to extend
AndroidTestCase as MediaPlayer has a service component requiring an
Android context.  Everything seems to work correctly except the
MediaPlayer listeners never fire, which prevents the playback from
starting (without OnPreparedListener I can't know when to start audio

Any thoughts?

2. HTC Touch Pro skin for Android Emulator

I finished the HTC Touch Pro skin for the Android Emulator in portrait

Grab it here:

Have fun.

3. AIDL Concept!!!

4. Jar libraries support

5. TextView with scroll bar?

6. 4 Questions: Auto-Focus, VVM, TTS, VOIP

7. How do i obtain the click even using ExpandableListActivity