Re: [android-developers] Problems with Linkify in Android 4

2012-06-13 Thread Jim Anderson
After playing around with this on the emulator, it looks like it's
HTC-specific. Plain Android 4 does Linkify just fine, while my HTC One S
doesn't fire intents from Linkify. Odd, but I can work around that.

Cheers,
Jim

Fear is the dark room where the Devil develops his negatives.

   - Gary Busey


On Thu, Jun 7, 2012 at 1:49 PM, Jim Anderson jbheml...@gmail.com wrote:

 I've tried moving all the data tags for each intent filter into one tag,
 and adding a mimetype attribute, but that doesn't work. Intent filters both
 with separate or consolidated data tags works in 2.2. I haven't gotten a
 lot of time at my dev box over the last few days, but the next thing I want
 to try is to generate a plain Android 4 emulator image and see if my
 Linkify code works with that.

 About 15% of my players have Android 4, and I haven't gotten any reports
 of this from the field, so I'm starting to suspect it is HTC-specific. The
 Android 4 emulator test should tell me more. I'll keep you folks informed
 about what I find out.


 Cheers,
 Jim

 Fear is the dark room where the Devil develops his negatives.

- Gary Busey


 On Tue, Jun 5, 2012 at 4:05 AM, Mark Murphy mmur...@commonsware.comwrote:

 On Mon, Jun 4, 2012 at 6:32 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Or it might be a missing mimeType attribute in the intent filter (since
 the
  uri uses the content scheme).

 Having consulted with some HTCians, the Linkify change they made
 simply blocks the appearance of a chooser. If there is more than one
 activity that handles a given Intent triggered by the Linkify link,
 they go with the default.

 So, while it's possible the HTC Linkify somehow fits, it seems less
 likely, unless there's a bug in their implementation. Hence, I agree
 that the intent-filter may be the problem. I'd first try:

 data android:scheme=content android:host=com.ctenophore.gso.help /

 which more accurately describes your scenario (right now, you claim to
 handle everything in the content:// scheme, and *also* claiming to
 handle everything with your specified host). If that does not help,
 add in android:mimeType=... to the one data element, replacing ...
 with the appropriate value for whatever this activity handles. For
 example, if you are linking to HTML pages, use
 android:mimeType=text/html.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 3.7 Available!

 --
 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

Re: [android-developers] Problems with Linkify in Android 4

2012-06-07 Thread Jim Anderson
I've tried moving all the data tags for each intent filter into one tag,
and adding a mimetype attribute, but that doesn't work. Intent filters both
with separate or consolidated data tags works in 2.2. I haven't gotten a
lot of time at my dev box over the last few days, but the next thing I want
to try is to generate a plain Android 4 emulator image and see if my
Linkify code works with that.

About 15% of my players have Android 4, and I haven't gotten any reports of
this from the field, so I'm starting to suspect it is HTC-specific. The
Android 4 emulator test should tell me more. I'll keep you folks informed
about what I find out.

Cheers,
Jim

Fear is the dark room where the Devil develops his negatives.

   - Gary Busey


On Tue, Jun 5, 2012 at 4:05 AM, Mark Murphy mmur...@commonsware.com wrote:

 On Mon, Jun 4, 2012 at 6:32 PM, Kostya Vasilyev kmans...@gmail.com
 wrote:
  Or it might be a missing mimeType attribute in the intent filter (since
 the
  uri uses the content scheme).

 Having consulted with some HTCians, the Linkify change they made
 simply blocks the appearance of a chooser. If there is more than one
 activity that handles a given Intent triggered by the Linkify link,
 they go with the default.

 So, while it's possible the HTC Linkify somehow fits, it seems less
 likely, unless there's a bug in their implementation. Hence, I agree
 that the intent-filter may be the problem. I'd first try:

 data android:scheme=content android:host=com.ctenophore.gso.help /

 which more accurately describes your scenario (right now, you claim to
 handle everything in the content:// scheme, and *also* claiming to
 handle everything with your specified host). If that does not help,
 add in android:mimeType=... to the one data element, replacing ...
 with the appropriate value for whatever this activity handles. For
 example, if you are linking to HTML pages, use
 android:mimeType=text/html.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 _The Busy Coder's Guide to Android Development_ Version 3.7 Available!

 --
 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] Problems with Linkify in Android 4

2012-06-04 Thread Jim Anderson
Hey folks,

My application (Ghost SEED) makes heavy use of Linkify for an in-app help
system. I use a fairly standard setup: I linkify text on an activity
displaying help, with the links firing an intent that I filter in the same
help activity. In older versions of Android (2.1, 2.2, etc) this works
fine. On my HTC One S, which runs 4.0.3, it doesn't work. Linkify does
correctly create links, but my activity never gets called with the intent.
Does anyone have an idea what might have changed here?

I'm including the appropriate code snippets below:
 From the manifest -
activity android:name=.ClientUI.HelpActivity class=HelpActivity
android:theme=@android:style/Theme.Dialog
intent-filter
category android:name=android.intent.category.DEFAULT/
action android:name=android.intent.action.VIEW/
data android:scheme=content/
data android:host=com.ctenophore.gso.help/
/intent-filter
/activity
 From the code that calls Linkify -
public final static String helpPrefix =
content://com.ctenophore.gso.help/;
...
public static void LinkifyText(TextView text) {
ArrayListString keywords = GSOHelpItems.titles();
StringBuilder sb = new StringBuilder();
boolean gotOne = false;
for (String keyword : keywords) {
if (gotOne)
sb.append('|');
else
gotOne = true;

sb.append(\\b);
sb.append(keyword);
sb.append(\\b);
}
Pattern matcher = Pattern.compile(sb.toString(), Pattern.DOTALL);
Linkify.addLinks(text, matcher, helpPrefix);
}

 From the activity -
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);


Uri data = getIntent().getData();
if (data == null) {
// Do some stuff
} else {
String url = data.toString();
// Do some stuff with the url --- NOTE: This is never reached in
Android 4
}

Cheers,
Jim

Fear is the dark room where the Devil develops his negatives.

   - Gary Busey

-- 
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