How to enter a text string in App?

Post your questions and help other users.

Moderator: Martin

Post Reply
Econdoc
Posts: 153
Joined: 28 May 2016 20:06

How to enter a text string in App?

Post by Econdoc » 06 Feb 2018 15:43

I would like to paste some info from the clipboard into an email. I also would like to enter a text string on the subject line of the email...something like "Take a look at this." It was no trouble to launch my email app or to paste the info I wanted into the message body using Control UI. However, I could not figure out how to put a text string in the subject line. Any suggestions?

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: How to enter a text string in App?

Post by Desmanto » 06 Feb 2018 16:12

What email app do you use? If gmail, the subject element Id is com.google.android.gm:id/subject. You can use

Code: Select all

setText2ById("com.google.android.gm:id/subject", "Take a look at this");
If you need to put your clipboard there, just replace the text with your clipboard variable. If you still need to use the old paste method, you need to use the Control UI to focus on the subject element id first, then paste() at there.

But for email, we have the intent activity to do it, which is much more reliable than using Control UI. Check out action Start Activity, examples : Compose Mail. Fill in the variable needed at the extras.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Econdoc
Posts: 153
Joined: 28 May 2016 20:06

Re: How to enter a text string in App?

Post by Econdoc » 07 Feb 2018 00:57

Thanks.
As always, your provided enough info for me to find a solution to my problem.

Post Reply