Sunday, October 31, 2010

Re: [android-developers] Re: Linkify

Hi,
Thanks for the reply.. I am trying to do what you said.
I defined a string:

<string name= "support_request">Support Request: <a href="support@unl.com?subject=Comments">support@unl.com</a></string>

In my .java code, I created a textview and called the setMovementmethod like this:

        TextView emailLink;
        emailLink = (TextView) this.findViewById(R.id.support_request);     
        emailLink.setMovementMethod(LinkMovementMethod.getInstance());


I am getting the error below when I run the app and click on the email text:
11-01 02:44:42.431: ERROR/AndroidRuntime(1870): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=support@unl.com?subject=Comments (has extras) }

I think I am missing something in the manifest file. I am not sure what I need to fill there. Whar do I enter in the data field in the intent filter?

Here is my intent filter I have defined in the corresponding activity:
                   <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" android:host=support@unl.com"/>
            </intent-filter>

I think I am doing something wrong here.
Please Help.

Thanks,
Priyank

On Sat, Oct 30, 2010 at 7:31 PM, Lance Nanek <lnanek@gmail.com> wrote:
I haven't gotten autoLink/Linkify to work with subjects, but I have
used explicit mailto href values that included the subject parameter
in TextView views successfully. The way I did it the string in the
strings XML has a literal anchor tag in it with the mailto href
including a subject parameter. I set the string via the text attribute
on the TextView in XML and the HTML link gets converted properly. Then
I also call:
setMovementMethod(LinkMovementMethod.getInstance());

On the TextView from code. The amount of HTML a TextView will parse is
limited, but apparently it is enough for mailto links with subject
parameters, at least.

On Oct 30, 5:55 pm, Priyank <priyankvma...@gmail.com> wrote:
> Hi,
>
> I am stuck at a place when I was using Linkify to create Link an email
> id to the Android email app.
>
> I have a large sentence in a textview which has an email id. On
> clicking on it, it opens my android email app. But The problem is
> that, I cannot add any subject or message in the mail. Is there any
> way of doing this using linkify ? Or do I have to use any other way
> for doing this.
> I initially used a textview which had just the email id, from which I
> could add the subject and message, but i will have to keep the email
> id in a separate line. I want the entire line in the textview where
> the email id comes in the middle of the sentence.
>
> I am currently doing like this:
>
>         TextView emailLink;
>         emailLink = (TextView)
> this.findViewById(R.id.support_request);
>         Linkify.addLinks(emailLink,Linkify.EMAIL_ADDRESSES);
>
> Thanks,
> Priyank

--
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+unsubscribe@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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment