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 would have expected.

> myPhoneTestActivity.startActivityForResult(myIntent,
> CALL_SETUP_ACTIVITY_ID);  <== Crashes here, NullPointer

Use your already-existing Activity, the one with the button.

> Thus, the ACTION_CALL is now being launched as a sub-Activity.
> The behavior of this code inside an Activity is the same as it is
> inside a Service - it crashes at the same place with a
> NullPointerException (null mInstrumentation).

Correct. myPhoneTestActivity isn't created by the Android framework.

It may be easier to think of Activity as being a plug-in to Android more 
so than a "program" in the traditional sense. Most plug-in frameworks 
don't give you fully-working plugins just by instantiating them. 
Instead, the plugins need to be wired into the overall system, code that 
frequently is done by whoever is launching the plugin itself, outside 
the bounds of the plugin's own constructors or callbacks.

> I'm attempting to launch this new Activity with the ACTION_CALL Intent
> and Android does not ~appear~ anyway, to know what to do with it.  If
> that theory is true, then no wonder the Activity is crashing...

I've only tried ACTION_DIAL recently.

However, it seems to work for this person:

http://www.androiddevelopment.org/2008/10/21/android-development-demo-dialanumber-how-to-write-your-own-very-first-android-program-made-simple/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
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