0
我想從一個ArrayList中獲取位圖圖像,並隨機生成一個網格用於網絡遊戲。我有這樣的方法在另一大類分開,我GameView類:在自定義視圖畫布上隨機放置網格中的位圖?
public int getGridElem(int x, int y) {
if (x < 0 || y < 0 || x >= mColumns || y >= mRows) {
throw new IndexOutOfBoundsException("The coordinates (" + x + ", " + y + ") are not valid.");
}
return mGrid[gridPos(x, y)];
}
林奮力工作,如何使用這個類來顯示ArrayList中的圖像的隨機網格?