It's the code for startActivity. I don't need to solve this problem if I 
can close AngryBirds (which is launched as an Intent)

On Monday, July 30, 2012 9:20:21 AM UTC-7, bob wrote:
>
> Well, what does line 3190 of Activity.java look like?
>
>
>
> On Sunday, July 29, 2012 6:30:04 PM UTC-5, HV wrote:
>>
>> Hi,
>>
>>  I have an Activity class that is calling another Activity class which is 
>> trying to launch an app (using Intent), but I'm seeing a crash right now. 
>> any ideas what could be the issue? Here is the crash log:
>>
>> E/SubAct  ( 2978): SubAct::SubAct, Enter...
>> E/SubAct  ( 2978): SubAct::StartApp, Calling startActivity...
>> D/AndroidRuntime( 2978): Shutting down VM
>> W/dalvikvm( 2978): threadid=1: thread exiting with uncaught exception 
>> (group=0x6e3a71f8)
>> E/AndroidRuntime( 2978): FATAL EXCEPTION: main
>> E/AndroidRuntime( 2978): java.lang.NullPointerException
>> E/AndroidRuntime( 2978):        at 
>> android.app.Activity.startActivityForResult(Activity.java:3190)
>> E/AndroidRuntime( 2978):        at 
>> android.app.Activity.startActivity(Activity.java:3297)
>> E/AndroidRuntime( 2978):        at 
>> com.broadcom.sockserver.SubAct.StartApp(SubAct.java:53)
>> E/AndroidRuntime( 2978):        at 
>> com.broadcom.sockserver.SockServer$1.handleMessage(SockServer.java:48)
>> E/AndroidRuntime( 2978):        at 
>> android.os.Handler.dispatchMessage(Handler.java:95)
>> E/AndroidRuntime( 2978):        at android.os.Looper.loop(Looper.java:137)
>> E/AndroidRuntime( 2978):        at 
>> android.app.ActivityThread.main(ActivityThread.java:4424)
>> E/AndroidRuntime( 2978):        at 
>> java.lang.reflect.Method.invokeNative(Native Method)
>> E/AndroidRuntime( 2978):        at 
>> java.lang.reflect.Method.invoke(Method.java:511)
>> E/AndroidRuntime( 2978):        at 
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
>> E/AndroidRuntime( 2978):        at 
>> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
>> E/AndroidRuntime( 2978):        at dalvik.system.NativeStart.main(Native 
>> Method)
>>
>> My code snippet:
>> *****
>> public class SockServer extends Activity 
>> {
>> ...
>>     Handler mHandler = new Handler(new Handler.Callback()
>>     {
>>         @Override
>>         public boolean handleMessage(Message msg)
>>         {
>>             Log.e(TAG, "msg.what = " +msg.what);
>>
>>             if (msg.what == 1)
>>             {
>>                 ABApp = new SubAct();
>>                 ABApp.StartApp();
>>             }
>>         
>>             else if (msg.what == 2)
>>             {
>>                 ABApp.StopApp();
>>             }            
>>
>>             return true;
>>         }
>>     });
>>
>> *****
>> public class SubAct extends Activity
>> {
>>     public Intent MyIntent;
>>     public int iReqCode;
>>     public String TAG = "SubAct";
>>
>>     public SubAct()
>>     {
>>         Log.e(TAG, "SubAct::SubAct, Enter...");
>>
>>         MyIntent = new Intent();
>>
>>         MyIntent.setAction(Intent.ACTION_VIEW);
>>         MyIntent.setClassName("com.rovio.angrybirds", 
>> "com.rovio.ka3d.App");
>>         iReqCode = 10;
>>     }
>>
>>     public void StartApp()
>>     {
>>         Log.e(TAG, "SubAct::StartApp, Calling startActivity...");
>>         startActivity(MyIntent);
>>     }
>> ****
>>
>> Instead of calling  SubAct, if I just use my Intent code in SockServer, 
>> it will launch AngryBirds (but calling finish is not stopping AB). The only 
>> reason I'm using the SubAct, is so that I can call finish/finishActivity & 
>> I'm expecting that will kill AB. 
>>
>> Thanks for any tips
>> HV
>>
>>

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to