pressing home button to launch the web browser

by Dianne Hackborn » Sat, 23 Jan 2010 10:16:40 GMT


Sponsored Links
 Well what is the stack crawl when it crashes?




> website: 



pressing home button to launch the web browser

by Jun Sun » Mon, 25 Jan 2010 12:40:27 GMT


 ig thanks for pointing to this useful debugging feature ("adb
logcat"). I have fixed the problem.

As I suspected, the context is a system service, which is not suitable
to start an intent activity. And the error message actually gives a
clue on the fix, which is to add FLAG_ACTIVITY_NEW_TASK flag.

Below is the new snippet that works to make the record complete. I
also attached the related log output.

Cheers.

Jun

-------------------

void showRecentAppsDialog() {
// [jsun]

Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://192.168.0.1/"));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(i);
/*
if (mRecentAppsDialog == null) {
mRecentAppsDialog = new RecentApplicationsDialog(mContext);
}
mRecentAppsDialog.show();
*/
}


-------------------

W/dalvikvm( 76): threadid=39: thread exiting with uncaught exception
(group=0x4001da28)^M
E/AndroidRuntime( 76): Uncaught handler: thread WindowManagerPolicy
exiting due to uncaught exception^M
E/AndroidRuntime( 76): *** EXCEPTION IN SYSTEM PROCESS. System will crash.^M
I/ActivityManager( 76): Start proc com.android.settings for
broadcast com.android.settings/.widget.SettingsAppWidgetProvider:
pid=253 uid=1000 gids={3002, 3001, 3003}^M
E/AndroidRuntime( 76): android.util.AndroidRuntimeException: Calling
startActivity() from outside of an Activity context requires the
FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?^M
E/AndroidRuntime( 76): at
android.app.ApplicationContext.startActivity(ApplicationContext.java:649)^M
E/AndroidRuntime( 76): at
com.android.internal.policy.impl.PhoneWindowManager.showRecentAppsDialog(PhoneWindowManager.java:425)^M
E/AndroidRuntime( 76): at
com.android.internal.policy.impl.PhoneWindowManager$2.run(PhoneWindowManager.java:416)^M
E/AndroidRuntime( 76): at
android.os.Handler.handleCallback(Handler.java:587)^M
E/AndroidRuntime( 76): at
android.os.Handler.dispatchMessage(Handler.java:92)^M
E/AndroidRuntime( 76): at android.os.Looper.loop(Looper.java:123)^M
E/AndroidRuntime( 76): at
com.android.server.WindowManagerService$PolicyThread.run(WindowManagerService.java:509)^M
I/Process ( 76): Sending signal. PID: 76 SIG: 9^M
...

On Sat, Jan 23, 2010 at 2:52 PM, Dianne Hackborn <hack...@android.com> wrote:

--


Sponsored Links


Other Threads

1. Installing android SDK

When I run "SDK Setup.exe", it gives me the following error when
trying to refresh sources:


Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml,
reason: HTTPS SSL error. You might want to force download through HTTP
in the settings.


I do as it says and enable force http, but still get the same error.
Does this have to do with my http server/proxy settings? In the
settings tab, they are blank.

I'm running Windows 7. However I did try to run the installer under
administrator mode, and in compatability mode (which shouldn't be
necessary, Google supports vista).

Thanks a ton!

2. moving Views and View.getWidth(), getHeight(), etc..

I am working on an app that requires widgets to be repositioned at
runtime. The docs say getWidth() should return the width of View at
runtime but the only value  getWidth() returns is 0. Can someone point
me in the right direction on how to get the dimensions of a view at
runtime?

3. No actions in intent filter at /data/app/ApiDemos.apk

4. Pretty code program (for all developers)...

5. Simulating accelerometer events natively?

6. Best way to launch Messaging app via intent

7. Plz post "Hello, DatePicker" code