Write an app that displays the picture defined by this text file:
R,50,50,350,100,#DC143C
O,50,200,250,100,#E9967A
R,50,350,150,100,#B8860B
O,50,500,50,100,#00FA9A
R means rectangle, O means oval. The
fields are x and y coordinates of the upper
left corner, and the width and height of the rectangle or of the bounding
rectangle for the ovals. The last field is the hex color code.
Save this data in res/raw/drawing.txt and access it in
onCreate like this:
InputStream iStream = getResources( ).
openRawResource(R.raw.myfile);
Scanner scanner = new Scanner(iStream);
Answer: Here are the source code files:
activity_main.xml
Shape.java
MyView.java
MainActivity.java