這是我作爲Android初學者一直在努力解決的問題。我無法在網上找到任何有關處理複雜對象的教程。我見過的所有例子都涉及只保存原語的簡單類。包含其他對象的Android-包裝對象?
但是,在我的情況下,我有一個複雜的迷宮對象聚合其他對象。
舉例來說,這裏是我的迷宮類:
public class Maze {
int mazew; // width of maze
int mazeh; // height of maze
Cells mazecells ; // maze as a matrix of cells which keep track of the location of walls
Distance mazedists ; // a matrix with distance values for each cell towards the exit
Cells seencells ; // a matrix with cells
BSPNode rootnode ; // a binary tree type search data structure to quickly locate a subset of segments
...
這裏是電池類:
public class Cells {
private int width;
private int height ;
private int[][] cells;
...
我怎麼會去parceling的對象,如包含其他對象迷宮?如果這些聚合對象也包含其他對象呢?如果我必須做嵌套的裝飾物,我無法想象要解析整個物體鏈。有關如何以最佳方式在活動之間傳遞Maze
對象的任何建議,敬請期待!
看起來他不想做這個工作讓所有的東西都可以做到。 – 2014-11-22 01:38:32
想要什麼以及他能得到什麼有時可以完全不同:) – 2014-11-22 01:43:10
我已經決定使用parcelabe,但是我找不到某個人正在讀取/寫入對象而不是原語的例子。 – mrQWERTY 2014-11-22 01:59:50