Office Hours — Today, April 10

Thursday, April 5

Apr 10
9:55 AM
Mark M.
has entered the room
Mark M.
turned on guest access
10:00 AM
Ron T.
has entered the room
Mark M.
howdy, Ron!
how can I help you today?
Ron T.
View paste
Hello, I have an activity, say myActivity, with a TextView myTV. I need to have both phone numbers and email addresses 'linkified' so that when the a phone number is clicked, it goes to the dialer. But when an email address is clicked, it needs to go to an email activity in my app and NOT display the standard context menu.  I put the following code in the myActivity onResume event after the text is set in myTV:

            Linkify.addLinks(myTV, Linkify.PHONE_NUMBERS);
            String userViewURL = "com.infopower.ams.user://";
            Linkify.addLinks(myTV, android.util.Patterns.EMAIL_ADDRESS, userViewURL);

I put the following in my email activity manifest entry:

          <intent-filter> 
		<category android:name="android.intent.category.DEFAULT" />
		<action android:name="android.intent.action.VIEW" />
		<data android:scheme="com.infopower.ams.user" />
	  </intent-filter> 

This all seems to work great except that when I'm in the dialer or my target email activity, pressing the BACK button does NOT return me to the myActivity screen but rather to whatever was on the device before I entered myActivity. I really need it to return to myActivity. Any thoughts?
Mark M.
wow, you type fast
:-)
ok
let me make sure I have this correct
scratch that
how is the user getting to myActivity?
Ron T.
myActivity can be launched from a Broadcast Receiver (C2DM) or by a service I have running
Mark M.
ah
10:05 AM
Mark M.
give me a moment to research something
I suggest that you temporarily rig up some other way to get to myActivity (e.g., give it the LAUNCHER <intent-filter>) and examine the behavior when it is started that way
my guess is that the combination of the way myActivity is being started, plus possibly some behavior in what TextView links do, is causing your difficulty
Ron T.
Yeah, I'll try to put together a simpler call chain and review that behavior.
Mark M.
if that's correct, you *might* be able to address this via android:taskAffinity and/or android:allowTaskReparenting in the manifest
Ron T.
Okay, I'll have to read up on those topics as I've never used them.
Mark M.
however, I haven't run into this scenario before and therefore have not tried to solve it personally
neither have I :-)
advanced task wrangling isn't something that I have had to worry about yet
10:10 AM
Mark M.
also, if you come up with a sample project that can reproduce this behavior, shoot me the source code -- I'd like to look at it
Ron T.
Sounds good, I'll try it today and if I still have problems I'll chat again on Thursday! Thanks, I'm off to the office...
Mark M.
OK
Ron T.
has left the room
11:00 AM
Mark M.
turned off guest access

Thursday, April 5

 

Office Hours

People in this transcript

  • Mark Murphy
  • Ron Thomas