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 <[email protected]> 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 <[email protected]> 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" <[email protected]> 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 <[email protected]> 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:
> > > > ------------------------
>
> > > > <com.android.server.status.StatusBarView xmlns:android="http://
> > > > schemas.android.com/apk/res/android"
> > > >    android:background="@drawable/statusbar_background"
> > > >    android:orientation="vertical"
> > > >    android:focusable="true"
> > > >    android:descendantFocusability="afterDescendants"
>
> > > >    <LinearLayout android:id="@+id/icons"
> > > >        android:layout_width="match_parent"
> > > >        android:layout_height="match_parent"
> > > >        android:orientation="horizontal">
>
> > > >        <com.android.server.status.IconMerger android:id="@+id/
> > > > notificationIcons"
> > > >            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"/>
>
> > > >         <EditText android:id="@+id/urltextbox"
> > > >                android:hint="eg.www.google.com, "
> > > >                android:layout_width="150dip"
> > > >                android:layout_height="wrap_content"
> > > >                android:maxLines="1"/>
>
> > > >        <Button android:id="@+id/Go"
> > > >        android:layout_width="50dip"
> > > >        android:layout_height="wrap_content"
> > > >        android:text="@string/go"/>
>
> > > >        <LinearLayout android:id="@+id/statusIcons"
> > > >            android:layout_width="wrap_content"
> > > >            android:layout_height="match_parent"
> > > >            android:layout_alignParentRight="true"
> > > >            android:paddingRight="6dip"
> > > >            android:gravity="center_vertical"
> > > >            android:orientation="horizontal"/>
> > > >    </LinearLayout>
>
> > > >    <LinearLayout android:id="@+id/ticker"
> > > >        android:layout_width="match_parent"
> > > >        android:layout_height="match_parent"
> > > >        android:paddingLeft="6dip"
> > > >        android:animationCache="false"
> > > >        android:orientation="horizontal" >
> > > >        <ImageSwitcher android:id="@+id/tickerIcon"
> > > >            android:layout_width="wrap_content"
> > > >            android:layout_height="match_parent"
> > > >            android:layout_marginRight="8dip"
>
> > > >            <com.android.server.status.AnimatedImageView
> > > >                android:layout_width="25dip"
> > > >                android:layout_height="25dip"
> > > >                />
> > > >            <com.android.server.status.AnimatedImageView
> > > >                android:layout_width="25dip"
> > > >                android:layout_height="25dip"
> > > >                />
> > > >        </ImageSwitcher>
> > > >        <com.android.server.status.TickerView android:id="@+id/
> > > > tickerText"
> > > >            android:layout_width="0dip"
> > > >            android:layout_weight="1"
> > > >            android:layout_height="wrap_content"
> > > >            android:paddingTop="2dip"
> > > >            android:paddingRight="10dip">
> > > >            <TextView
> > > >                android:layout_width="match_parent"
> > > >                android:layout_height="wrap_content"
> > > >                android:singleLine="true"
> > > >                android:textColor="#ff000000" />
> > > >            <TextView
> > > >                android:layout_width="match_parent"
> > > >                android:layout_height="wrap_content"
> > > >                android:singleLine="true"
> > > >                android:textColor="#ff000000" />
> > > >        </com.android.server.status.TickerView>
> > > >    </LinearLayout>
>
> > > >    <com.android.server.status.DateView android:id="@+id/date"
> > > >        android:layout_width="wrap_content"
> > > >        android:layout_height="match_parent"
> > > >        android:singleLine="true"
> > > >        android:textSize="16sp"
> > > >        android:textStyle="bold"
> > > >        android:gravity="center_vertical|left"
> > > >        android:paddingLeft="6px"
> > > >        android:paddingRight="6px"
> > > >        android:textColor="?android:attr/textColorPrimaryInverse"
> > > >        android:background="@drawable/statusbar_background"
> > > >        />
> > > > </com.android.server.status.StatusBarView>
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<android-developers%2Bunsubs
> > > >  [email protected]><android-developers%2Bunsubs
> > [email protected]>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
>
> > >  A N K ! T......
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%2Bunsubs 
> > [email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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