correct way to use getSystemService?

by yesk13 » Mon, 13 Apr 2009 12:13:58 GMT

Sponsored Links
 KeyguardManager kg = ( KeyguardManager ) getSystemService
( "keyguard" )

is the above correct way to use to get a handle to KeyguardManager

i want to use OnKeyguardExitResult listening to it and do something if
user was not able to authenticate.

your help is greatly appreciated.


Other Threads

1. Loading bitmap: java.lang.OutOfMemoryError: bitmap size

Somebody tested my game (see on a
real device,
however occasionaly this exception is thrown when running the main
game Activity.
This activity loads a lot of resources in GamePainter.<init>.

(I know it is better to load resources in a separate thread, i'm
woking on it,
however this exception is unrelated to that (i think))

I dont now what the cause of this exception is, some VM memmory
allocation problem.
Is there not enough memory? If so, why does it run sometimes and other
times not?

The exception stack trace is below:

I/ActivityManager(   52): Starting activity: Intent {
comp={com.tjerk.spacewars/com.tjerk.spacewars.SpaceWarsActivity} }
D/AirAttackActivity(12208): Launching Game Activity
I/AirAttack(12208): Last conf instance: null
D/dalvikvm(12208): GC freed 7699 objects / 269024 bytes in 111ms
D/dalvikvm(12208): GC freed 347 objects / 14056 bytes in 84ms
E/dalvikvm-heap(12208): 1345600-byte external allocation too large for
this process.
E/        (12208): VM won't let us allocate 1345600 bytes
D/AndroidRuntime(12208): Shutting down VM
W/dalvikvm(12208): threadid=3: thread exiting with uncaught exception
E/AndroidRuntime(12208): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(12208): java.lang.OutOfMemoryError: bitmap size
exceeds VM budget
E/AndroidRuntime(12208):        at Method)
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at$1800(
E/AndroidRuntime(12208):        at$H.handleMessage(
E/AndroidRuntime(12208):        at android.os.Handler.dispatchMessage
E/AndroidRuntime(12208):        at android.os.Looper.loop(
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at
java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12208):        at java.lang.reflect.Method.invoke
E/AndroidRuntime(12208):        at$
E/AndroidRuntime(12208):        at
E/AndroidRuntime(12208):        at dalvik.system.NativeStart.main
(Native Method)
I/Process (   52): Sending signal. PID: 12208 SIG: 3
I/dalvikvm(12208): threadid=7: reacting to signal 3
I/dalvikvm(12208): Wrote stack trace to '/data/anr/traces.txt'

2. finding dynamic classes:

Hi All,

I have a query..

I am writing a app, which has sort of plugin framework.

public abstract class AbstractService
   public abstract AbstractService getInstance(String name);

i write some classes A, B, C which are derived from AbstractService.

Now, How do i create the instances of A, B or C dynamically with the help of
the String that is passed as the input parameter to the function

Could you please let me how they can achieve??



3. How can I get current SDK version in my program code ?

4. Flicker for widgets when pressing the touchscreen for android-1.5 and android-2.6.29 kernel version

5. How to use to build a project with JNI library calls?

6. CAMERA_STUB feature in android

7. How to make mmc partition read only yet, make /system /data writeable