Does it mean that I can take that piece of code and copy-paste into my app and maybe one day to sell the app?
If you comply with all the requirements of all the copyright licenses of all the third-party code in your app, then yes. It does generally not matter if you copy/paste the code into your app or if you use the code as an external library.
Open-source licenses do not forbid you from selling code, but some of them (copyleft licenses like the GPL) have requirements that make charging money for copies of the app economically unviable.
What you also have to take care of is that some licenses are not compatible with each other, which means that they can't be used together in the same app. And example of this is the GPLv2 and Apache 2.0 licenses.
To successfully use Apache 2.0 licensed code in your app, you must
- Provide the users of the app with a copy of the Apache 2.0 license
- Provide the users of the app with the contents of the NOTICES file, if such a file exists in the repository where you got the Apache-licensed code from
- Make it clear which parts of the app are governed by which license
If you make the source code available, then you must additionally
- Keep all copyright, patent, trademark and attribution notices intact (unless they refer to something you removed from your copy)
- Add a notice to modified files that you changed them.