Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to call Browser intent from status bar ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mani  
View profile  
 More options Sep 22 2010, 12:47 am
From: mani <smanikanda...@gmail.com>
Date: Tue, 21 Sep 2010 21:47:23 -0700 (PDT)
Local: Wed, Sep 22 2010 12:47 am
Subject: how to call Browser intent from status bar ?
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)

/frameworks/base/services/java/com/android/server/status/
StatusBarService.java --> I was trying to implement it like this.

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);
                    }
                });
--------------------------
-------------------------

}

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"      /// newly
introduced editbox & button
                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>

Thanks,
Mani


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »