Skip to content
Advertisement

Android copy text from edittext

I’m having some trouble whilst following a beginner android dev program. I build an Android App and I have created EditText and Button.

My idea, users can put PhoneNumber in EditText, and if they click the Copy button, they can copy shortUrl with PhonNumber that inputed! So, I have create a String with Url. and if the users put the number will get it in the Url! Example:

users typed: +1716322765 if user click “The Button”, will get “https://google.me/+1716322765”

So, I wrote this code, but does not execute.

JavaScript

Advertisement

Answer

You want if(!copy.isEmpty()). Otherwise you would only copy if there was no phone number entered.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement