public static void updatelayer() {
   // TODO Auto-generated method stub
   Actor object;
   if (arrayListAObject == null) return;
   for (int i = 0; i < arrayListAObject.size(); i++) {
     object = arrayListAObject.get(i);
     object.update();
   }
 }
 public static void drawLayerObject() {
   Actor object;
   if (arrayListAObject == null) return;
   for (int i = 0; i < arrayListAObject.size(); i++) {
     object = arrayListAObject.get(i);
     object.render();
     // Log.d("draw actor", "draw object");
   }
 }
  public static synchronized boolean loadLayerBG(String path)
      throws IOException, XmlPullParserException {
    // listBitmap = new ArrayList<Bitmap>();
    // listBitmap.clear();
    String directorystr = path.substring(0, path.lastIndexOf("/"));
    Log.e("Directory : ", directorystr);
    XmlPullParser xrp = null;
    InputStream istr = GameLib.mainView.getContext().getAssets().open(path);
    XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
    factory.setNamespaceAware(false);
    xrp = factory.newPullParser();
    xrp.setInput(istr, "UTF-8");
    if (arrayListBitmap != null) {
      arrayListBitmap.clear();
    }
    if (arrayListDataMap != null) {
      arrayListDataMap.clear();
    }
    arrayListBitmap = new ArrayList<Bitmap>();
    arrayListDataMap = new ArrayList<int[][]>();
    arrayListAObject = new ArrayList<Actor>();
    int eventType = 0;
    eventType = xrp.getEventType();
    String tagName = "";
    Actor object = null;
    while (eventType != XmlPullParser.END_DOCUMENT) {
      switch (eventType) {
        case XmlPullParser.START_DOCUMENT:
          break;
        case XmlPullParser.START_TAG:
          tagName = xrp.getName();
          if (tagName.equals("map")) {
            MAX_TILE_COLUMN = Integer.parseInt(xrp.getAttributeValue(null, "width"));
            MAX_TILE_ROW = Integer.parseInt(xrp.getAttributeValue(null, "height"));
            TILE_WIDTH = Integer.parseInt(xrp.getAttributeValue(null, "tilewidth"));
            TILE_HEIGHT = Integer.parseInt(xrp.getAttributeValue(null, "tileheight"));
            MAP_WIDTH_PIXEL = MAX_TILE_COLUMN * TILE_WIDTH;
            MAP_HEIGHT_PIXEL = MAX_TILE_ROW * TILE_HEIGHT;
          } else if (tagName.equals("tileset")) {
            if (xrp.getAttributeValue(null, "name").equals("physic")) {
              PHYSIC_INT_NUM_BEGIN = Integer.parseInt(xrp.getAttributeValue(null, "firstgid")) - 1;
            }
          } else if (tagName.equals("image")) {
            Bitmap tempBitmap =
                GameLib.loadImageFromAsset(
                    directorystr + "/" + xrp.getAttributeValue(null, "source"));
            int lenBitmapArrayrow = (tempBitmap.getHeight() / TILE_HEIGHT);
            int lenBitmapArraycol = (tempBitmap.getWidth() / TILE_WIDTH);
            // arrayBitmap = new
            // Bitmap[lenBitmapArrayrow*lenBitmapArraycol];
            Log.d("lenBitmapArrayrow:", " " + lenBitmapArrayrow);
            Log.d("lenBitmapArraycol:", " " + lenBitmapArraycol);
            for (int row = 0; row < lenBitmapArrayrow; row++) {
              for (int col = 0; col < lenBitmapArraycol; col++) {
                arrayListBitmap.add(
                    Bitmap.createBitmap(
                        tempBitmap,
                        col * TILE_WIDTH,
                        row * TILE_HEIGHT,
                        TILE_WIDTH,
                        TILE_HEIGHT,
                        null,
                        false)); // here
              }
            }
            tempBitmap = null;
          } else if (tagName.equals("object")) {

            // <object name="doorright" type="door" x="1374" y="569"
            // width="47" height="61">

            // object = new Actor();
            String NAME = xrp.getAttributeValue(null, "name");
            String TYPE = xrp.getAttributeValue(null, "type");
            int m_x = Integer.parseInt(xrp.getAttributeValue(null, "x"));
            int m_y = Integer.parseInt(xrp.getAttributeValue(null, "y"));
            int m_Width = Integer.parseInt(xrp.getAttributeValue(null, "width"));
            int m_Height = Integer.parseInt(xrp.getAttributeValue(null, "height"));
            object = Actor.createActor(m_x, m_y, m_Width, m_Height, NAME, TYPE);

          } else if (tagName.equals("property")) {
            String name = xrp.getAttributeValue(null, "name");
            if (name.equals("level")) {
              String value = xrp.getAttributeValue(null, "value");
            }
          }
          break;
        case XmlPullParser.TEXT:

          // Log.d("text", xrp.getText());
          if (tagName.equals("data")) {
            int[][] tempArray = new int[MAX_TILE_ROW][MAX_TILE_COLUMN];
            String str = xrp.getText();
            if (str.charAt(0) == '\n') str = str.substring(1);
            String[] strArray = str.split("\n");
            String[] strTempInt; // = str.split("\n");
            for (int row = 0; row < MAX_TILE_ROW; row++) {
              strTempInt = strArray[row].split(",");
              for (int col = 0; col < MAX_TILE_COLUMN; col++) {
                // tempArray[row][col] = new int();
                int num = Integer.parseInt(strTempInt[col]);
                tempArray[row][col] = (num - 1);
              }
            }
            tagName = " ";
            arrayListDataMap.add(tempArray);
          }
          break;
        case XmlPullParser.END_TAG:
          tagName = xrp.getName();
          if (tagName.equals("object")) {
            if (object != null) arrayListAObject.add(object);
          }
          tagName = " ";
          break;
      }
      eventType = xrp.next();
    }
    return true;
  }