1. ImageTool.java: Image tool class
2. The layout is very simple. A GridView is directly laid out:
3、layout/activity_add_photo.xml
4. UploadPhotoActivity.java: Main Activity
5. Because the image URI obtained by Android 4.4 or above is com.xxxxx, you need to make a judgment in the tool class, otherwise you will not get the absolute address of the image.
6、SquareRelativeLayout.java:
7. The above is the entire content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.
8. Effect display
9. Layout files
10. The examples in this article share with you the specific code for Android to choose QQ picture and photos for your reference. The specific content is as follows
11. The tool category refers to a blog from someone else. I forgot to leave the blog address. Please forgive me.
12. Finally, you need to add a permission:
13. Code implementation
14. layout/activity_add_photo_gv_items.xml uses a custom view to make the layout square