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. CPU usage & power management question


The easiest way to get some idea about cpu usage on android seems to
be the top utility (adb shell top)
However it seems to me that due to power management the cpu frequency
is changing all the time (i can see this when doing cat /proc/cpuinfo
- the BogoMIPS value is changing drastically). So the question is that
how does top calculate the cpu usage percent? Is it aware of max
possible cpu frequency and calculates based on that or it calculates
based on current cpu frequency?

Consider these 2 cases:
1) BogoMIPS shows 100 while top says my process takes 50% of the cpu
2) BocoMIPS shows 600 while top says my process takes 50% of the cpu
Does this mean that in first case my process was eating 50 BogoMIPS
and in second case 300 (top is not aware of max possible cpu freq)? or
in both cases my process took same amount of cpu (top is aware of max



2. creating service with bluetooth activation


I want to create a service in Android which will initially ask user if
he/she wants to start blue-tooth and set the blue-tooth discovery.

My questions are

1) Can i launch in the service following activities ?? if
(!mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new
startActivityForResult(enableBtIntent, 0); }

// Set Phone Discoverable for 300 seconds. Intent discoverableIntent = new
600); startActivity(discoverableIntent);

2) I want to set discoverabilty of the phone on for lifetime of application.
is it possible??

3) I want to access empty space available on sd card. How should i do it??

Thanks in advance.


3. Fans Star Trek pasti berkaca-kaca

4. 2

5. Why launch is canceled in android

6. Problem in SSL Socket write

7. Oot: WTA gmail lemot?