I'm trying to learn java for android -- after many years coding AS3 for flash.
I'm using Android studio.
I've gone through a bunch of tutorials but all of them either: Draw shapes/bitmaps directly in the main class OR Create references to a shape (Rect or something) in a secondary class then use a getRect command from the main class and THEN draw the image (but none have done this with a bitmap image so far) OR Use the xml layout tools and create no images through code at all.
Can someone explain to me (or point me in the direction of a tutorial) how I can create images inside subclasses (and what those classes would need to extend?)
I have a MainActivity class and a GameView class which I have copied from one of the tutorials I've done. I removed what the GameView was drawing, but kept everything else.
Instead I have it looking like this:
This works fine.
The above works fine, although I'm not sure if GridLayout is what I want to be extending. I think it is because after I make the tiles I want them to be arranged in the GridLayout position.
This class is the one giving me trouble.
First, I don't know what to extend. In AS3 I would extend Sprite and just do all my drawing right inside this object.
Second, I don't know how to draw from this class into the main view. Trying to get a bitmap like it currently is doesn't work because it doesn't see the resources.
I want each instance of "Tile" to have the view of my tile.png overlayed with a text field holding 'myChar'.
Then "TileHolder" should contain all those tiles (in a grid) to be displayed on the screen.
Again.. Can someone explain to me (or point me in the direction of a tutorial) how I can create images inside my Tile class to be displayed by my GameView class?
I can never remember what to do with images, but have you tried the Java® Tutorials? There are several pages about images. I think that section is intended for Swing, so it might be different on Android.