Android - copy and paste un-slelectable text - android

I am building an app which requires the user to copy and paste a ten digit identification number from another app on the phone. Only thing is, in the other app, the ID number is presented as a header/title bar. I am sure it is not an image with text. Most apps for custom text capture require the user to take a screenshot and use some OCR operation to harvest the text from an image.
I find this as taking too many steps for my users, some of whom may not even know how to take a screenshot with android using the volume and power buttons.
Is there any way to copy and paste text that is un-highlightable on an app without using a screenshot?
Can I code my app to add context menu option on long press any text on screen so I can grab this text?

Related

How does Android's image copy-paste work and can this feature be expanded/modified?

Apologies if there is already information about this. I couldn't find anything.
On Android, you can long-press an image and choose copy. On other apps, such as Messages, Discord, FB Messenger, and Twitter, the image will show up as a suggestion above the keyboard. If you tap it, it will upload the image to the text/tweet/etc. It also works when searching on Chrome - you can either select "Image you copied" or use the keyboard suggestion like with other apps. However, long-pressing the text input and selecting Paste does NOT work in any of these apps.
How does this image copy-paste function work? Is it something that could be emulated with other file types other than images, such as audio files? Can you force a file from an app to show up in the keyboard suggestions on other apps? Or, is it just a built-in feature that can't really be expanded on at all? Thanks for your help.
How does this image copy-paste function work?
Android has a Clipboard Framework which can be used to copy & paste content from one place to other
Is it something that could be emulated with other file types other than images, such as audio files
Android supports generic way to copy paste content, as long as the content is a standard multi-media type you can do copy paste. only prerequisite is that the both application should support the file-type.
The app you are copying the content should know how to put the data in the clipboard, and the app that you are pasting should know how to decode the content.
Android provide all information like, whats the content type and everything so what matters is both app should make use of this Clipboard framework.
Can you force a file from an app to show up in the keyboard suggestions on other apps?
You can't force it appear on top of keyboard, even a simple copied text will show only one time on top of keyboard. even though the content present on clipboard keyboard won't show it second or third time.
It's basically specific to how a keyboard app is designed, the above scenario is true for G-board at the time of writing this.

Spinner in Android (With phone codes and automatic country recognition)

I would like to create a spinner in Android XML, which will have list of the phone codes (ex. USA - +1), and after choosing the phone code at the bottom I want a program to show the country name of the chosen phone code. It should work automatically, which means whenever I change the phone code, it will change the name of the Country.
Thanks!
you can use 3rd party library for this.
https://github.com/hbb20/CountryCodePickerProject/blob/master/README.md?fbclid=IwAR1tz_D3PTEUyy2-zaGG0QTZWda_8ss9nbSml-z7zyI3gULLFsibIlRhujs
if you want to you own program you can try i can help if any difficult situation.

Edit translation text at runtime from server

Overview
AFAIK on Android you have twi ways to set the texts of your application:
You can use string.xml with different locales
You can download strings from server and set every label with a setText(language.text) but it will be a pain
The problem might sussist if you have to change a text of your published application without re-publishing it; for example if you want to change for a specific translation a small text without any functionality change. (ie: you might notice that you wrote "Take picure" instead of "Take picture").
Library
i18next is a good library to manage translations dinamically from server, but you still have to add the text for each label you got.
So, my question is
Still AFAIK, there is no way to do it natively, but is there a low level library or a workaround that allows to replace a string in your string.xml with some downloaded text?
Another option could be to make our label text to point instead of at #string/myValue to something like #myresource.pathtovalue.
Honestly I think this could be an huge improvement for application, is there something useful?

Android program to recognize text on screen

I am creating a macro (see my previous question:
https://stackoverflow.com/questions/35121221/difficulties-writing-a-custom-macro-application-for-android),
and that macro needs to recognize text from a certain area of the device screen while running in the background.
Basic summary:
The program will run in the background similar to a macro, while scanning for text in a messaging app (which I will manually open after starting the program)
Basically what it needs to do is read all text on screen and convert it into a string(I've got the rest of the code)
Now, I need some sort of help on the text recognition. Since I cant directly copy the text, I'd need some function to scan for text and convert it into a string.
Any help/pointers would be much appreciated.

Replace default smileys menu

I want to replace the default smileys menu (the one that shows up when the smiley button on the virtual keyboard is pressed) with a custom one with own drawables. Is this even possible?
If not, is there any way to get access to the smartphone's default smiley drawables so I can show them in my textview?
I'd love to use my own ones though. Any suggestions?
No. Not without making your own keyboard. Which you can do of course. Part of the reason that this is a no is that each keyboard does smilies on its own, so they all have different ones.
You can put any image you want in a textview - just use an ImageSpan. Android doesn't really have default emoticons (although an OEM may use a consistent set across pre-installed apps). Either keyboards will insert their own emoticons via image spans, or apps will see a familiar pattern like :-) in the text and convert it into an image span. If you want the images from the default android keyboard you can find those in the AOSP somewhere, or by unzipping the apk file.

Categories

Resources