[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-13 Thread dreamerBoy
Hi Mark - Yes, thank you for that - ~so~ much better. Call starts, screen changes.. ooh aah. However, still some issues - Right off, PhoneStateListener callback isn't being invoked for one. Still analyzing the logCat... Frustrating for me that the API is so coy about what is a Thread, what

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-13 Thread dreamerBoy
OK - I invoked ACTION_CALL using startActivityForResult(Intent, MY_ID). I then called finishActivity(MY_ID) - that should have killed the ACTION_CALL Activity created by the system. However, I can confirm that it does not. My next brainwave was to generate a keypress on the hang-up button -

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-12 Thread dreamerBoy
New Approach ... I have a Hello, World-type program. Basically all I do is say Hello, World, install a useless button with a button-handler (to forestall ANR a little), and then I attempt to make a call with the ACTION_CALL Intent. I am no longer attempting to start the ACTION_CALL Activity

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-12 Thread Mark Murphy
dreamerBoy wrote: Uri parsedPhoneNumber = Uri.parse(tel:1234567); Intent myIntent = new Intent(Intent.ACTION_CALL, parsedPhoneNumber); Activity myPhoneTestActivity = new Activity(); Don't do that third line. I'm surprised it even works -- I guess Activity isn't an abstract superclass like I

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread dreamerBoy
initiateCall is just an Activity. Activity initiateCall = new Activity(); (actually a derived class of Activity with nothing added but debug statements to signal when each lifecycle/callback method is called). On Nov 10, 5:37 pm, dreamerBoy [EMAIL PROTECTED] wrote: Hi - thank you for your

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread dreamerBoy
Hmmm... so perhaps I can call wait() or use some other kind of synchronizer until I get the proper onCreate callback. Thank you very much for that ... it's a start. On Nov 10, 5:42 pm, hackbod [EMAIL PROTECTED] wrote: Probably you are calling this before Activity.onCreate(), which is where

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread dreamerBoy
Sorry... I should have checked my logCat ... in fact onCreate has already been called at the point where the NullPointerException is thrown. On Nov 10, 5:42 pm, hackbod [EMAIL PROTECTED] wrote: Probably you are calling this before Activity.onCreate(), which is where the mInstrumentation field

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread dreamerBoy
On Nov 10, 6:12 pm, Mark Murphy [EMAIL PROTECTED] wrote: dreamerBoywrote: Thanks for the reply, Mark (I recognize the name - I read your book.) In the ACTION_CALL documentation, it states: Note: there will be restrictions on which applications can initiate a call; most applications

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread dreamerBoy
Actually, thank you - you WERE correct - onCreate is NOT being called for this Activity. I tried doing a wait() for 5 - then 30 seconds on the onCreate callback being called - the wait timed out... Hmmm how to force an Activity to properly initialize itself. On Nov 10, 5:42 pm,

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread dreamerBoy
Battle of the quotes, from: http://code.google.com/android/reference/android/app/Service.html Other application components running in the same process as the service (such as an Activity) can, of course, increase the importance of the overall process beyond just the importance of the service

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread hackbod
On Nov 11, 11:35 am, dreamerBoy [EMAIL PROTECTED] wrote: Actually, thank you - you WERE correct - onCreate is NOT being called for this Activity. I tried doing a wait() for 5  - then 30 seconds on the onCreate callback being called - the wait timed out...  Hmmm how to force an Activity

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-11 Thread Mark Murphy
dreamerBoy wrote: You could putter through the source code to see how the in-call application handles it. Again, whatever technique it uses is probably not for public consumption, your mileage may vary, do not taunt Happy Fun Android, etc. I thought that Android was supposed to be about

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread dreamerBoy
Thanks for your reply - ha ha, wouldn't that be nice if it were that simple. Nope, I checked the return from the Uri.parse - not null. I got a hold of the Android source code. It is crashing here in Activity.java: public void startActivityForResult(Intent intent, int requestCode) {

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread dreamerBoy
Taking a hint from the source code, I tried to implement an Instrumentation class in the hopes that that was what Android was looking for - Added: instrumentation android:targetPackage=test.phone android:name=.PhoneTestInstrumentation/instrumentation and uses-permission

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread Christine
Your log says that the error is in line 254 of PhoneTestService, if that's a class you wrote. On Nov 11, 1:20 am, dreamerBoy [EMAIL PROTECTED] wrote: Taking a hint from the source code, I tried to implement an Instrumentation class in the hopes that that was what Android was looking for -

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread Mark Murphy
dreamerBoy wrote: However, same error. I'm somewhat skeptical that launching an activity, particularly via startActivityForResult(), will work from a service. I know it's in the API, but think about what that means: some background process can cause a full-fledged activity to spawn in front

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread dreamerBoy
Hi - thank you for your reply. Yes, line 254 is just: initiateCall.startActivityForResult(myIntent, CALL_SETUP_ACTIVITY_ID); That is the statement that throws the NullPointerException. On Nov 10, 4:28 pm, Christine [EMAIL PROTECTED] wrote: Your log says that the error is in line 254

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread Mark Murphy
dreamerBoy wrote: Hi - thank you for your reply. Yes, line 254 is just: initiateCall.startActivityForResult(myIntent, CALL_SETUP_ACTIVITY_ID); What is initiateCall? -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread hackbod
Probably you are calling this before Activity.onCreate(), which is where the mInstrumentation field is set. Note that calling into an activity from a Service like this is pretty sketchy -- you will need to be very very careful about activity lifecycle and updating the service as the activity

[android-developers] Re: Head-scratcher: NullPointerException from startActivity(ACTION_CALL)

2008-11-10 Thread Mark Murphy
dreamerBoy wrote: Thanks for the reply, Mark (I recognize the name - I read your book.) Thanks! I am trying to place a call with the Activity that may - but need not, have any graphical UI aspect to it. Launching an Activity appears to be the only way to place a call in Android 1.0. If