Re: [android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
You are right, it is a bug on Admob that was solved on version 6.1.0, and I am using the 6.0.1 exactly the previous one... :-| https://developers.google.com/mobile-ads-sdk/docs/rel-notes I should looked at that release notes before... Well, it is easy to solve then. Thanks, On 11/20/2012 09:31 AM, Nikolay Elenkov wrote: On Tue, Nov 20, 2012 at 3:33 AM, Francisco Marzoa wrote: On 11/18/2012 12:56 PM, Piren wrote: It actually says it right there: 3 at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) The user is clicking a hyperlink in a webview which is attached to the Application Context. Figure out which webview it is, set a webViewClient and override shouldOverrideUrlLoading to open the hyperlink properly. I am not sure about what to do, to be honest. There may be when the user clicks on an ad from Admob or Chartboost, the two ad networks I use, but in this case I think I couldn't do nothing since their libraries are closed. You can of course decompile and patch :) This error was quite common with one of the previous releases of the AdMob library. Upgrade to the latest version, it is fixed there. I don't know anything about Chartboost though. -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
On Tue, Nov 20, 2012 at 3:33 AM, Francisco Marzoa wrote: > On 11/18/2012 12:56 PM, Piren wrote: > > It actually says it right there: 3 at > android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) > > The user is clicking a hyperlink in a webview which is attached to the > Application Context. Figure out which webview it is, set a webViewClient and > override shouldOverrideUrlLoading to open the hyperlink properly. > > I am not sure about what to do, to be honest. There may be when the user > clicks on an ad from Admob or Chartboost, the two ad networks I use, but in > this case I think I couldn't do nothing since their libraries are closed. > You can of course decompile and patch :) This error was quite common with one of the previous releases of the AdMob library. Upgrade to the latest version, it is fixed there. I don't know anything about Chartboost though. -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
You're probably using them incorrectly. You should consult with their support On Monday, November 19, 2012 8:35:44 PM UTC+2, Fran wrote: > > On 11/18/2012 12:56 PM, Piren wrote: > > It actually says it right there: 3 at > android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) > > The user is clicking a hyperlink in a webview which is attached to the > Application Context. Figure out which webview it is, set a webViewClient and > override shouldOverrideUrlLoading to open the hyperlink properly. > > I am not sure about what to do, to be honest. There may be when the user > clicks on an ad from Admob or Chartboost, the two ad networks I use, but in > this case I think I couldn't do nothing since their libraries are closed. > > > On Sunday, November 18, 2012 12:23:52 PM UTC+2, Fran wrote: >> >> Hi, >> >> I am getting many reports of crashes with this error condition: >> >> android.util.AndroidRuntimeException: Calling startActivity() from >> outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is >> this really what you want? >> >> The problem is that the reported stack does not made reference to any >> line on my own code: >> >> 0 android.util.AndroidRuntimeException: Calling startActivity() from >> outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is >> this really what you want? >> 1 at android.app.ContextImpl.startActivity(ContextImpl.java:618) >> 2 at android.content.ContextWrapper.startActivity(ContextWrapper.java:258) >> 3 at >> android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) >> 4 at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:331) >> 5 at android.os.Handler.dispatchMessage(Handler.java:99) >> 6 at android.os.Looper.loop(Looper.java:123) >> 7 at android.app.ActivityThread.main(ActivityThread.java:3652) >> 8 at java.lang.reflect.Method.invokeNative(Native Method) >> 9 at java.lang.reflect.Method.invoke(Method.java:507) >> 10 at >> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) >> 11 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) >> 12 at dalvik.system.NativeStart.main(Native Method) >> >> So I am having real troubles to find the source of the problem. >> >> Does anyone have any idea on what methods called from my code may raise >> these kind of errors? >> >> TIA >> >> -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to > android-d...@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > > > -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
On 11/18/2012 12:56 PM, Piren wrote: |It actually says it right there:|3 at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) The user is clicking a hyperlink in a webview which is attached to the Application Context. Figure out which webview it is, set a webViewClient and override shouldOverrideUrlLoading to open the hyperlink properly. I am not sure about what to do, to be honest. There may be when the user clicks on an ad from Admob or Chartboost, the two ad networks I use, but in this case I think I couldn't do nothing since their libraries are closed. On Sunday, November 18, 2012 12:23:52 PM UTC+2, Fran wrote: Hi, I am getting many reports of crashes with this error condition: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? The problem is that the reported stack does not made reference to any line on my own code: 0 android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 1 at android.app.ContextImpl.startActivity(ContextImpl.java:618) 2 at android.content.ContextWrapper.startActivity(ContextWrapper.java:258) 3 at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) 4 at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:331) 5 at android.os.Handler.dispatchMessage(Handler.java:99) 6 at android.os.Looper.loop(Looper.java:123) 7 at android.app.ActivityThread.main(ActivityThread.java:3652) 8 at java.lang.reflect.Method.invokeNative(Native Method) 9 at java.lang.reflect.Method.invoke(Method.java:507) 10 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 11 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 12 at dalvik.system.NativeStart.main(Native Method) So I am having real troubles to find the source of the problem. Does anyone have any idea on what methods called from my code may raise these kind of errors? TIA -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
It actually says it right there: 3 at android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) The user is clicking a hyperlink in a webview which is attached to the Application Context. Figure out which webview it is, set a webViewClient and override shouldOverrideUrlLoading to open the hyperlink properly. On Sunday, November 18, 2012 12:23:52 PM UTC+2, Fran wrote: > > Hi, > > I am getting many reports of crashes with this error condition: > > android.util.AndroidRuntimeException: Calling startActivity() from outside > of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this > really what you want? > > The problem is that the reported stack does not made reference to any line > on my own code: > > 0 android.util.AndroidRuntimeException: Calling startActivity() from > outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is > this really what you want? > 1 at android.app.ContextImpl.startActivity(ContextImpl.java:618) > 2 at android.content.ContextWrapper.startActivity(ContextWrapper.java:258) > 3 at > android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) > 4 at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:331) > 5 at android.os.Handler.dispatchMessage(Handler.java:99) > 6 at android.os.Looper.loop(Looper.java:123) > 7 at android.app.ActivityThread.main(ActivityThread.java:3652) > 8 at java.lang.reflect.Method.invokeNative(Native Method) > 9 at java.lang.reflect.Method.invoke(Method.java:507) > 10 at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) > 11 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) > 12 at dalvik.system.NativeStart.main(Native Method) > > So I am having real troubles to find the source of the problem. > > Does anyone have any idea on what methods called from my code may raise > these kind of errors? > > TIA > > -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag
Francisco Marzoa wrote: > Hi, > > I am getting many reports of crashes with this error condition: > > android.util.AndroidRuntimeException: Calling startActivity() from > outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. > Is this really what you want? > > The problem is that the reported stack does not made reference to any > line on my own code: > > 0 android.util.AndroidRuntimeException: Calling startActivity() from > outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. > Is this really what you want? > 1 at android.app.ContextImpl.startActivity(ContextImpl.java:618) > 2 at android.content.ContextWrapper.startActivity(ContextWrapper.java:258) > 3 at > android.webkit.CallbackProxy.uiOverrideUrlLoading(CallbackProxy.java:236) > 4 at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:331) > 5 at android.os.Handler.dispatchMessage(Handler.java:99) > 6 at android.os.Looper.loop(Looper.java:123) > 7 at android.app.ActivityThread.main(ActivityThread.java:3652) > 8 at java.lang.reflect.Method.invokeNative(Native Method) > 9 at java.lang.reflect.Method.invoke(Method.java:507) > 10 at > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) > 11 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) > 12 at dalvik.system.NativeStart.main(Native Method) > > So I am having real troubles to find the source of the problem. > > Does anyone have any idea on what methods called from my code may raise > these kind of errors? > > TIA just a wild guess but its similar to this http://stackoverflow.com/questions/6481178/androidruntimeexception-when-a-hyperlink-is-clicked-in-dialog-shown-on-first-run pskink -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag ?
I put a similar post in Android-platform.!! Hoping for some support from framework engineers. Thanks, Mani On Sep 22, 1:15 am, Dianne Hackborn wrote: > Please move this to a group for platform development, such as > android-porting or android-platform. > > > > > > On Tue, Sep 21, 2010 at 4:58 AM, mani wrote: > > I even tried to do > > this.getApplicationContext().startActivity() --> but this anyway not > > possible coz am not under a Activity instance. > > So how should i tackle this ?? > > > Anyone who has worked on statusbar...could help me .. > > > On Sep 21, 7:36 pm, "A N K ! T" wrote: > > > have u try to put this line after defining intent. > > > browserIntent .setFlag(Intent.FLAG_ACTIVITY_NEW_TASK); > > > > On Tue, Sep 21, 2010 at 4:39 PM, mani wrote: > > > > Hi all, > > > > > I tried to create a edittextbox, and button next to it, in the status > > > > bar. !! > > > > I created it and tried to launch the browser activity, when somebody > > > > enters a URL in the textbox & click that button. > > > > > I get runtime exception as below.Can anyone please help what is the > > > > issue with this exception ? > > > > I know that Status bar is not a seperate activity. It is part of > > > > 'PhoneWindow'. But then i couldnt figure out what is the issue ? > > > > Framework experts coud you pls help here...!! > > > > > E/AndroidRuntime( 70): *** FATAL EXCEPTION IN SYSTEM PROCESS: > > > > android.server.ServerThread > > > > E/AndroidRuntime( 70): android.util.AndroidRuntimeException: Calling > > > > startActivity() from outside of an Activity context requires the > > > > FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? > > > > E/AndroidRuntime( 70): at > > > > android.app.ContextImpl.startActivity(ContextImpl.java:617) > > > > E/AndroidRuntime( 70): at > > > > com.android.server.status.StatusBarService > > > > $1.onClick(StatusBarService.java:289) > > > > E/AndroidRuntime( 70): at > > > > android.view.View.performClick(View.java: > > > > 2408) > > > > E/AndroidRuntime( 70): at android.view.View > > > > $PerformClick.run(View.java:8816) > > > > E/AndroidRuntime( 70): at > > > > android.os.Handler.handleCallback(Handler.java:587) > > > > E/AndroidRuntime( 70): at > > > > android.os.Handler.dispatchMessage(Handler.java:92) > > > > E/AndroidRuntime( 70): at > > android.os.Looper.loop(Looper.java:123) > > > > E/AndroidRuntime( 70): at > > > > com.android.server.ServerThread.run(SystemServer.java:506) > > > > > private void makeStatusBarView(Context context) { > > > > > > > > > > > > urlTextbox = (EditText)sb.findViewById(R.id.urltextbox); > > > > Button mButton = (Button) sb.findViewById(R.id.Go); > > > > mButton.setOnClickListener(new Button.OnClickListener(){ > > > > public void onClick(View v) { > > > > System.out.println("Status Bar - Onclick > > of > > > > GO"); > > > > String url = > > urlTextbox.getText().toString(); > > > > Intent browserIntent = new > > > > Intent("android.intent.action.VIEW", Uri.parse(url)); > > > > mContext.startActivity(browserIntent); > > > > } > > > > }); > > > > > -- > > > > - > > > > > } > > > > > /frameworks/base/services/java/com/android/server/status/ > > > > StatusBarService.java --> I was trying to implement it like this. > > > > > status_bar.xml: > > > > > > > > > > > > android:background="@drawable/statusbar_background" > > > > android:orientation="vertical" > > > > android:focusable="true" > > > > android:descendantFocusability="afterDescendants" > > > > > > > > android:layout_width="match_parent" > > > > android:layout_height="match_parent" > > > > android:orientation="horizontal"> > > > > > > > > android:layout_width="0dip" > > > > android:layout_weight="1" > > > > android:layout_height="match_parent" > > > > android:layout_alignParentLeft="true" > > > > android:paddingLeft="6dip" > > > > android:gravity="center_vertical" > > > > android:orientation="horizontal"/> > > > > > > > > android:hint="eg.www.google.com, " > > > > android:layout_width="150dip" > > > > android:layout_height="wrap_content" > > > > android:maxLines="1"/> > > > > > > > > android:layout_width="50dip" > > > > android:layout_height="wrap_content" > > > > android:text="@string/go"/> > > > > > > > > android:layout_width="wrap_content" > > > > android:layout_height="match_parent" > > > > android:layout_alignParentRight="true" > > > >
Re: [android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag ?
Please move this to a group for platform development, such as android-porting or android-platform. On Tue, Sep 21, 2010 at 4:58 AM, mani wrote: > I even tried to do > this.getApplicationContext().startActivity() --> but this anyway not > possible coz am not under a Activity instance. > So how should i tackle this ?? > > Anyone who has worked on statusbar...could help me .. > > On Sep 21, 7:36 pm, "A N K ! T" wrote: > > have u try to put this line after defining intent. > > browserIntent .setFlag(Intent.FLAG_ACTIVITY_NEW_TASK); > > > > > > > > > > > > On Tue, Sep 21, 2010 at 4:39 PM, mani wrote: > > > Hi all, > > > > > I tried to create a edittextbox, and button next to it, in the status > > > bar. !! > > > I created it and tried to launch the browser activity, when somebody > > > enters a URL in the textbox & click that button. > > > > > I get runtime exception as below.Can anyone please help what is the > > > issue with this exception ? > > > I know that Status bar is not a seperate activity. It is part of > > > 'PhoneWindow'. But then i couldnt figure out what is the issue ? > > > Framework experts coud you pls help here...!! > > > > > E/AndroidRuntime( 70): *** FATAL EXCEPTION IN SYSTEM PROCESS: > > > android.server.ServerThread > > > E/AndroidRuntime( 70): android.util.AndroidRuntimeException: Calling > > > startActivity() from outside of an Activity context requires the > > > FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? > > > E/AndroidRuntime( 70):at > > > android.app.ContextImpl.startActivity(ContextImpl.java:617) > > > E/AndroidRuntime( 70):at > > > com.android.server.status.StatusBarService > > > $1.onClick(StatusBarService.java:289) > > > E/AndroidRuntime( 70):at > > > android.view.View.performClick(View.java: > > > 2408) > > > E/AndroidRuntime( 70):at android.view.View > > > $PerformClick.run(View.java:8816) > > > E/AndroidRuntime( 70):at > > > android.os.Handler.handleCallback(Handler.java:587) > > > E/AndroidRuntime( 70):at > > > android.os.Handler.dispatchMessage(Handler.java:92) > > > E/AndroidRuntime( 70):at > android.os.Looper.loop(Looper.java:123) > > > E/AndroidRuntime( 70):at > > > com.android.server.ServerThread.run(SystemServer.java:506) > > > > > private void makeStatusBarView(Context context) { > > > > > > > > >urlTextbox = (EditText)sb.findViewById(R.id.urltextbox); > > >Button mButton = (Button) sb.findViewById(R.id.Go); > > >mButton.setOnClickListener(new Button.OnClickListener(){ > > >public void onClick(View v) { > > >System.out.println("Status Bar - Onclick > of > > > GO"); > > > String url = > urlTextbox.getText().toString(); > > > Intent browserIntent = new > > > Intent("android.intent.action.VIEW", Uri.parse(url)); > > > mContext.startActivity(browserIntent); > > >} > > >}); > > > > > -- > > > - > > > > > } > > > > > /frameworks/base/services/java/com/android/server/status/ > > > StatusBarService.java --> I was trying to implement it like this. > > > > > status_bar.xml: > > > > > > > > > >android:background="@drawable/statusbar_background" > > >android:orientation="vertical" > > >android:focusable="true" > > >android:descendantFocusability="afterDescendants" > > > > > > >android:layout_width="match_parent" > > >android:layout_height="match_parent" > > >android:orientation="horizontal"> > > > > > > >android:layout_width="0dip" > > >android:layout_weight="1" > > >android:layout_height="match_parent" > > >android:layout_alignParentLeft="true" > > >android:paddingLeft="6dip" > > >android:gravity="center_vertical" > > >android:orientation="horizontal"/> > > > > > > >android:hint="eg.www.google.com, " > > >android:layout_width="150dip" > > >android:layout_height="wrap_content" > > >android:maxLines="1"/> > > > > > > >android:layout_width="50dip" > > >android:layout_height="wrap_content" > > >android:text="@string/go"/> > > > > > > >android:layout_width="wrap_content" > > >android:layout_height="match_parent" > > >android:layout_alignParentRight="true" > > >android:paddingRight="6dip" > > >android:gravity="center_vertical" > > >android:orientation="horizontal"/> > > > > > > > > > >android:layout_width="match_parent" > > >android:layout_height="match_parent" > > >android:paddingLeft="6dip" > > >andro
Re: [android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag ?
then try to use webview On Tue, Sep 21, 2010 at 5:18 PM, mani wrote: > Yes i tried now.!! It dint work...:( > > - mani > > On Sep 21, 7:36 pm, "A N K ! T" wrote: > > have u try to put this line after defining intent. > > browserIntent .setFlag(Intent.FLAG_ACTIVITY_NEW_TASK); > > > > > > > > > > > > On Tue, Sep 21, 2010 at 4:39 PM, mani wrote: > > > Hi all, > > > > > I tried to create a edittextbox, and button next to it, in the status > > > bar. !! > > > I created it and tried to launch the browser activity, when somebody > > > enters a URL in the textbox & click that button. > > > > > I get runtime exception as below.Can anyone please help what is the > > > issue with this exception ? > > > I know that Status bar is not a seperate activity. It is part of > > > 'PhoneWindow'. But then i couldnt figure out what is the issue ? > > > Framework experts coud you pls help here...!! > > > > > E/AndroidRuntime( 70): *** FATAL EXCEPTION IN SYSTEM PROCESS: > > > android.server.ServerThread > > > E/AndroidRuntime( 70): android.util.AndroidRuntimeException: Calling > > > startActivity() from outside of an Activity context requires the > > > FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? > > > E/AndroidRuntime( 70):at > > > android.app.ContextImpl.startActivity(ContextImpl.java:617) > > > E/AndroidRuntime( 70):at > > > com.android.server.status.StatusBarService > > > $1.onClick(StatusBarService.java:289) > > > E/AndroidRuntime( 70):at > > > android.view.View.performClick(View.java: > > > 2408) > > > E/AndroidRuntime( 70):at android.view.View > > > $PerformClick.run(View.java:8816) > > > E/AndroidRuntime( 70):at > > > android.os.Handler.handleCallback(Handler.java:587) > > > E/AndroidRuntime( 70):at > > > android.os.Handler.dispatchMessage(Handler.java:92) > > > E/AndroidRuntime( 70):at > android.os.Looper.loop(Looper.java:123) > > > E/AndroidRuntime( 70):at > > > com.android.server.ServerThread.run(SystemServer.java:506) > > > > > private void makeStatusBarView(Context context) { > > > > > > > > >urlTextbox = (EditText)sb.findViewById(R.id.urltextbox); > > >Button mButton = (Button) sb.findViewById(R.id.Go); > > >mButton.setOnClickListener(new Button.OnClickListener(){ > > >public void onClick(View v) { > > >System.out.println("Status Bar - Onclick > of > > > GO"); > > > String url = > urlTextbox.getText().toString(); > > > Intent browserIntent = new > > > Intent("android.intent.action.VIEW", Uri.parse(url)); > > > mContext.startActivity(browserIntent); > > >} > > >}); > > > > > -- > > > - > > > > > } > > > > > /frameworks/base/services/java/com/android/server/status/ > > > StatusBarService.java --> I was trying to implement it like this. > > > > > status_bar.xml: > > > > > > > > > >android:background="@drawable/statusbar_background" > > >android:orientation="vertical" > > >android:focusable="true" > > >android:descendantFocusability="afterDescendants" > > > > > > >android:layout_width="match_parent" > > >android:layout_height="match_parent" > > >android:orientation="horizontal"> > > > > > > >android:layout_width="0dip" > > >android:layout_weight="1" > > >android:layout_height="match_parent" > > >android:layout_alignParentLeft="true" > > >android:paddingLeft="6dip" > > >android:gravity="center_vertical" > > >android:orientation="horizontal"/> > > > > > > >android:hint="eg.www.google.com, " > > >android:layout_width="150dip" > > >android:layout_height="wrap_content" > > >android:maxLines="1"/> > > > > > > >android:layout_width="50dip" > > >android:layout_height="wrap_content" > > >android:text="@string/go"/> > > > > > > >android:layout_width="wrap_content" > > >android:layout_height="match_parent" > > >android:layout_alignParentRight="true" > > >android:paddingRight="6dip" > > >android:gravity="center_vertical" > > >android:orientation="horizontal"/> > > > > > > > > > >android:layout_width="match_parent" > > >android:layout_height="match_parent" > > >android:paddingLeft="6dip" > > >android:animationCache="false" > > >android:orientation="horizontal" > > > > > >android:layout_width="wrap_content" > > >android:layout_height="match_parent" > > >android:layout_marginRight="8dip" > > > > >
[android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag ?
I even tried to do this.getApplicationContext().startActivity() --> but this anyway not possible coz am not under a Activity instance. So how should i tackle this ?? Anyone who has worked on statusbar...could help me .. On Sep 21, 7:36 pm, "A N K ! T" wrote: > have u try to put this line after defining intent. > browserIntent .setFlag(Intent.FLAG_ACTIVITY_NEW_TASK); > > > > > > On Tue, Sep 21, 2010 at 4:39 PM, mani wrote: > > Hi all, > > > I tried to create a edittextbox, and button next to it, in the status > > bar. !! > > I created it and tried to launch the browser activity, when somebody > > enters a URL in the textbox & click that button. > > > I get runtime exception as below.Can anyone please help what is the > > issue with this exception ? > > I know that Status bar is not a seperate activity. It is part of > > 'PhoneWindow'. But then i couldnt figure out what is the issue ? > > Framework experts coud you pls help here...!! > > > E/AndroidRuntime( 70): *** FATAL EXCEPTION IN SYSTEM PROCESS: > > android.server.ServerThread > > E/AndroidRuntime( 70): android.util.AndroidRuntimeException: Calling > > startActivity() from outside of an Activity context requires the > > FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? > > E/AndroidRuntime( 70): at > > android.app.ContextImpl.startActivity(ContextImpl.java:617) > > E/AndroidRuntime( 70): at > > com.android.server.status.StatusBarService > > $1.onClick(StatusBarService.java:289) > > E/AndroidRuntime( 70): at > > android.view.View.performClick(View.java: > > 2408) > > E/AndroidRuntime( 70): at android.view.View > > $PerformClick.run(View.java:8816) > > E/AndroidRuntime( 70): at > > android.os.Handler.handleCallback(Handler.java:587) > > E/AndroidRuntime( 70): at > > android.os.Handler.dispatchMessage(Handler.java:92) > > E/AndroidRuntime( 70): at android.os.Looper.loop(Looper.java:123) > > E/AndroidRuntime( 70): at > > com.android.server.ServerThread.run(SystemServer.java:506) > > > private void makeStatusBarView(Context context) { > > > > > > urlTextbox = (EditText)sb.findViewById(R.id.urltextbox); > > Button mButton = (Button) sb.findViewById(R.id.Go); > > mButton.setOnClickListener(new Button.OnClickListener(){ > > public void onClick(View v) { > > System.out.println("Status Bar - Onclick of > > GO"); > > String url = urlTextbox.getText().toString(); > > Intent browserIntent = new > > Intent("android.intent.action.VIEW", Uri.parse(url)); > > mContext.startActivity(browserIntent); > > } > > }); > > > -- > > - > > > } > > > /frameworks/base/services/java/com/android/server/status/ > > StatusBarService.java --> I was trying to implement it like this. > > > status_bar.xml: > > > > > > android:background="@drawable/statusbar_background" > > android:orientation="vertical" > > android:focusable="true" > > android:descendantFocusability="afterDescendants" > > > > android:layout_width="match_parent" > > android:layout_height="match_parent" > > android:orientation="horizontal"> > > > > android:layout_width="0dip" > > android:layout_weight="1" > > android:layout_height="match_parent" > > android:layout_alignParentLeft="true" > > android:paddingLeft="6dip" > > android:gravity="center_vertical" > > android:orientation="horizontal"/> > > > > android:hint="eg.www.google.com, " > > android:layout_width="150dip" > > android:layout_height="wrap_content" > > android:maxLines="1"/> > > > > android:layout_width="50dip" > > android:layout_height="wrap_content" > > android:text="@string/go"/> > > > > android:layout_width="wrap_content" > > android:layout_height="match_parent" > > android:layout_alignParentRight="true" > > android:paddingRight="6dip" > > android:gravity="center_vertical" > > android:orientation="horizontal"/> > > > > > > android:layout_width="match_parent" > > android:layout_height="match_parent" > > android:paddingLeft="6dip" > > android:animationCache="false" > > android:orientation="horizontal" > > > > android:layout_width="wrap_content" > > android:layout_height="match_parent" > > android:layout_marginRight="8dip" > > > > android:layout_width="25dip" > > android:layout_height="25dip" > > /> > > >
[android-developers] Re: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag ?
Yes i tried now.!! It dint work...:( - mani On Sep 21, 7:36 pm, "A N K ! T" wrote: > have u try to put this line after defining intent. > browserIntent .setFlag(Intent.FLAG_ACTIVITY_NEW_TASK); > > > > > > On Tue, Sep 21, 2010 at 4:39 PM, mani wrote: > > Hi all, > > > I tried to create a edittextbox, and button next to it, in the status > > bar. !! > > I created it and tried to launch the browser activity, when somebody > > enters a URL in the textbox & click that button. > > > I get runtime exception as below.Can anyone please help what is the > > issue with this exception ? > > I know that Status bar is not a seperate activity. It is part of > > 'PhoneWindow'. But then i couldnt figure out what is the issue ? > > Framework experts coud you pls help here...!! > > > E/AndroidRuntime( 70): *** FATAL EXCEPTION IN SYSTEM PROCESS: > > android.server.ServerThread > > E/AndroidRuntime( 70): android.util.AndroidRuntimeException: Calling > > startActivity() from outside of an Activity context requires the > > FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? > > E/AndroidRuntime( 70): at > > android.app.ContextImpl.startActivity(ContextImpl.java:617) > > E/AndroidRuntime( 70): at > > com.android.server.status.StatusBarService > > $1.onClick(StatusBarService.java:289) > > E/AndroidRuntime( 70): at > > android.view.View.performClick(View.java: > > 2408) > > E/AndroidRuntime( 70): at android.view.View > > $PerformClick.run(View.java:8816) > > E/AndroidRuntime( 70): at > > android.os.Handler.handleCallback(Handler.java:587) > > E/AndroidRuntime( 70): at > > android.os.Handler.dispatchMessage(Handler.java:92) > > E/AndroidRuntime( 70): at android.os.Looper.loop(Looper.java:123) > > E/AndroidRuntime( 70): at > > com.android.server.ServerThread.run(SystemServer.java:506) > > > private void makeStatusBarView(Context context) { > > > > > > urlTextbox = (EditText)sb.findViewById(R.id.urltextbox); > > Button mButton = (Button) sb.findViewById(R.id.Go); > > mButton.setOnClickListener(new Button.OnClickListener(){ > > public void onClick(View v) { > > System.out.println("Status Bar - Onclick of > > GO"); > > String url = urlTextbox.getText().toString(); > > Intent browserIntent = new > > Intent("android.intent.action.VIEW", Uri.parse(url)); > > mContext.startActivity(browserIntent); > > } > > }); > > > -- > > - > > > } > > > /frameworks/base/services/java/com/android/server/status/ > > StatusBarService.java --> I was trying to implement it like this. > > > status_bar.xml: > > > > > > android:background="@drawable/statusbar_background" > > android:orientation="vertical" > > android:focusable="true" > > android:descendantFocusability="afterDescendants" > > > > android:layout_width="match_parent" > > android:layout_height="match_parent" > > android:orientation="horizontal"> > > > > android:layout_width="0dip" > > android:layout_weight="1" > > android:layout_height="match_parent" > > android:layout_alignParentLeft="true" > > android:paddingLeft="6dip" > > android:gravity="center_vertical" > > android:orientation="horizontal"/> > > > > android:hint="eg.www.google.com, " > > android:layout_width="150dip" > > android:layout_height="wrap_content" > > android:maxLines="1"/> > > > > android:layout_width="50dip" > > android:layout_height="wrap_content" > > android:text="@string/go"/> > > > > android:layout_width="wrap_content" > > android:layout_height="match_parent" > > android:layout_alignParentRight="true" > > android:paddingRight="6dip" > > android:gravity="center_vertical" > > android:orientation="horizontal"/> > > > > > > android:layout_width="match_parent" > > android:layout_height="match_parent" > > android:paddingLeft="6dip" > > android:animationCache="false" > > android:orientation="horizontal" > > > > android:layout_width="wrap_content" > > android:layout_height="match_parent" > > android:layout_marginRight="8dip" > > > > android:layout_width="25dip" > > android:layout_height="25dip" > > /> > > > android:layout_width="25dip" > > android:layout_height="25dip" > > /> > > > > > android:layout_width="0dip" > >