Catching clicks on xml files in the browser

by Rohit » Wed, 18 Mar 2009 05:33:45 GMT


Sponsored Links
 Hi,
      I am trying to intercept xml links that are clicked in the
android web browser. I want my activity to handle these xml files,
however I cannot seem to get this to work. Whenever I click on the xml
file in the browser it just displays the xml file.  Here is the entry
that I have in my AndroidManifest.xml. Is this enough or do I need to
do something more?

 <activity
                android:name="handleXML"
                android:theme="@android:style/Theme.Dialog"
                android:screenOrientation="portrait"
                >
                <intent-filter>
                        <action android:name="android.intent.action.VIEW" />
                        <category 
android:name="android.intent.category.DEFAULT" />
                        <category 
android:name="android.intent.category.BROWSABLE" /
                        <data android:scheme="http" />
                        <data android:scheme="https" />
                        <data android:mimeType="application/xml"/>
                        <data android:mimeType="text/xml"/>
                </intent-filter>
        </activity>



--~--~---------~--~----~------------~-------~--~----~



Catching clicks on xml files in the browser

by Rohit » Thu, 19 Mar 2009 01:19:00 GMT


 I guess adding an intent filter just allows my activity to start up if
someone starts a new intent with that data scheme and mimetype. I
guess it isn't meant for catching clicks in the browser. I guess the
code in the browser app needs to be changed to be able to start off a
new intent when a user clicks on an xml file - too much work? Does
anyone have any pointers as to where to begin if I wanted to do that?

Rohit



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Configuring Exchange email programmatically

Hi guys,

Can anyone give me some detail info for configuring exchange mail server
account programmatically ...??

AccountManager class doesnt give much info .. any pointers regarding the
same would be of great help.. thanks..

Thanks and Regards,
Balu

-- 

2. Custom ListAdaptor Issues

Hey everyone, I'm a little stuck right now. i'm getting some funky
errors when I try run my project.

Basically what it's doing is pulling a number of entries from a DB and
displaying them in a custom ListAdaptor.

I'm getting "ArrayAdapter requires the resource ID to be a TextView"
as a error

Here's where the Listview is populated

______________________________
public View getView(int position, View convertView, ViewGroup parent)
{

        View v = convertView;
        if (v == null) {
            LayoutInflater vi =
(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.status_container_list_entry,
null);
        }
        JobListAdaptor o = items.get(position);
        if (o != null) {
                TextView tt = (TextView) v.findViewById(R.id.toptext);
                TextView mt = (TextView)
v.findViewById(R.id.middletext);
                TextView bt = (TextView)
v.findViewById(R.id.bottomtext);
                //TextView st = (TextView)
v.findViewById(R.id.sidetext);

                if (tt != null) {
                      tt.setText("Name: "+
o.getName());
                }
                if(mt != null){
                    mt.setText("Provider: "+ o.getProvider());
                }
                if(bt != null){
                      bt.setText("Most Recent Feed Date: "+
o.getMostRecentFeedDate());
                }
                //if(st != null){
                //    st.setText("Status: "+ o.getStatus());
                //}

        }
        return v;
______________________________


Here's the XML display

______________________________
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="6dip">
    <ImageView
        android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="6dip"
        android:src="@drawable/icon" />
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="fill_parent">
        <TextView
            android:id="@+id/toptext"
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:gravity="center_vertical"
        />
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:id="@+id/middletext"
            android:singleLine="true"
            android:ellipsize="marquee"
        />
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:id="@+id/bottomtext"
            android:singleLine="true"
            android:ellipsize="marquee"
        />
         <TextView
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:id="@+id/sidetext"
            android:singleLine="true"
            android:ellipsize="marquee"
        />
    </LinearLayout>
</LinearLayout>
______________________________



And where's its called in my Home Activity

______________________________
private void showStatusItems(List<StatusContainer> list)
    {
        _loginLayout.setVisibility(View.INVISIBLE);
        _mainLayout.setVisibility(View.VISIBLE);


        ArrayAdapter<JobListAdaptor> listAdapter = new
ArrayAdapter<JobListAdaptor>(this,
R.layout.status_container_list_entry,
StatusContainer.getStatusItemList());

        _statusContainerListView.clearChoices();
        _statusContainerListView.setAdapter(listAdapter);

    }
______________________________


Any help or tips would be greatly appreciated..


-- 

3. Can I put a link page to my own market Apps?

4. 3.0 dialog with WebView inside FrameLayout doesn't resize

5. Reached MAX size for compiled-sql statement cache for database

6. Mod: Paging ID-Android Surabaya

7. New 3.0 Emulator - Lacking Google Maps API?