protected void onStart() {
    super.onStart();

    /*
     * productList.setOnItemClickListener(new OnItemClickListener() { public
     * void onItemClick(AdapterView parent, View v, int position, long id) {
     *
     *
     *
     * WatchListAllEntity wle = listrow.get(position);
     *
     *
     * Intent i = new Intent(CardOrder.this, CardDetailsActivity.class);
     * i.putExtra("wle", wle); startActivity(i);
     *
     * } });
     */

    viewList =
        new Runnable() {
          public void run() {

            PopulateListByJSONArray();
          }
        };
    Thread thread = new Thread(null, viewList, "MagentoBackground");
    thread.start();
    m_ProgressDialog = ProgressDialog.show(CardOrder.this, "", "しばらくお待ちください", true);
    m_ProgressDialog.setCancelable(true);

    Log.i("onResume", "onResume");

    Log.i("onStart", "onStart");
    productList = (ListView) findViewById(R.id.productlistall);
    // Constants.orderList=new ArrayList<String>();
    listrow = new ArrayList<WatchListAllEntity>();
    mAdapter = new MyCustomAdapter(this, listrow);

    productList.setAdapter(mAdapter);

    /*
     * if (resume) { Log.i("onResume", "onResume"); Intent intent =
     * getIntent(); finish(); startActivity(intent); } resume = true;
     */
    /*
     * Log.i("onResume", "onResume"); mAdapter.notifyDataSetChanged();
     */

  }
  // public ArrayList<String> orderList=null;
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Constants.productTabSelected = Constants.productTabAll;

    setContentView(R.layout.parchasehistory);

    cardlistButton = (Button) findViewById(R.id.cardlistButton);
    cardlistButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            try {
              if (CheckInternet.checkConn(PurchaseHistory.this)) {
                Intent historyInt = new Intent(PurchaseHistory.this, AllProductActivityNew.class);
                finish();
                startActivity(historyInt);
              } /*else {
                	Toast.makeText(PurchaseHistory.this, "只今サーバに接続できません。しばらくしてから接続してください。",
                			Toast.LENGTH_SHORT).show();
                }*/
            } catch (Exception e) {
              Toast.makeText(PurchaseHistory.this, e + "", Toast.LENGTH_LONG).show();
            }
          }
        });

    cameraButton = (Button) findViewById(R.id.cameraButton);
    cameraButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub

            final CharSequence[] items = {"カメラ", "ギャラリー"};

            AlertDialog.Builder builder = new AlertDialog.Builder(PurchaseHistory.this);
            builder.setTitle("写真を撮る");
            builder.setItems(
                items,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int item) {
                    if (item == 0) {
                      Constants.fromGallery = false;
                      Intent takePicInt =
                          new Intent(PurchaseHistory.this, PhotoIntentActivity.class);
                      takePicInt.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                      startActivity(takePicInt);
                    } else {
                      Constants.fromGallery = true;
                      Intent takePicInt = new Intent(PurchaseHistory.this, CameraCapture.class);
                      takePicInt.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                      startActivity(takePicInt);
                    }
                  }
                });
            AlertDialog alert = builder.create();
            alert.show();
          }
        });

    homeButton = (Button) findViewById(R.id.homeButton);
    homeButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            try {
              if (CheckInternet.checkConn(PurchaseHistory.this)) {
                Intent cardlistInt = new Intent(PurchaseHistory.this, Home.class);
                cardlistInt.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                startActivity(cardlistInt);

                finish();
              } /*else {
                	Toast.makeText(PurchaseHistory.this, "只今サーバに接続できません。しばらくしてから接続してください。",
                			Toast.LENGTH_SHORT).show();
                }*/
            } catch (Exception e) {
              Toast.makeText(PurchaseHistory.this, e + "", Toast.LENGTH_LONG).show();
            }
          }
        });

    productList = (ListView) findViewById(R.id.productlistall);
    // Constants.orderList=new ArrayList<String>();
    listrow = new ArrayList<PurchaseHistoryEntity>();
    mAdapter = new MyCustomAdapter(this, listrow);
    /*
     * for (int i = 1; i < 50; i++) { mAdapter.addItem("item " + i); if (i %
     * 4 == 0) { mAdapter.addSeparatorItem("separator " + i); } }
     */
    productList.setAdapter(mAdapter);

    productList.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView parent, View v, int position, long id) {

            /*int selectedIndex = ListOfVideos.getSelectedItemPosition();

            CardDetailsActivity.ImageUrl = listrow.get(position)
            		.getimageURl();
            CardDetailsActivity.productStatus = listrow.get(position)
            		.getProductStatus();
            CardDetailsActivity.uploadDate = listrow.get(position)
            		.getUploadDate();*/

            PurchaseHistoryEntity wle = listrow.get(position);

            Intent i = new Intent(PurchaseHistory.this, OrderDetailsActivity.class);
            i.putExtra("wle", wle);
            i.putExtra("listrow", listrow);
            startActivity(i);
          }
        });

    viewList =
        new Runnable() {
          public void run() {

            PopulateListByJSONArray();
          }
        };
    Thread thread = new Thread(null, viewList, "MagentoBackground");
    thread.start();
    m_ProgressDialog = ProgressDialog.show(PurchaseHistory.this, "", "しばらくお待ちください", true);
    m_ProgressDialog.setCancelable(true);
  }
  // public ArrayList<String> orderList=null;
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.cardorder);
    // resume = false;
    Constants.orderList = new ArrayList<String>();
    Log.i("onCreate", "onCreate");
    cardlistButton = (Button) findViewById(R.id.cardlistButton);
    cardlistButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            try {
              if (CheckInternet.checkConn(CardOrder.this)) {
                Intent listInt = new Intent(CardOrder.this, AllProductActivityNew.class);
                finish();
                startActivity(listInt);
              } /*else {
                	Toast.makeText(CardOrder.this,
                			"只今サーバに接続できません。しばらくしてから接続してください。",
                			Toast.LENGTH_SHORT).show();
                }*/
            } catch (Exception e) {
              Toast.makeText(CardOrder.this, e + "", Toast.LENGTH_LONG).show();
            }
          }
        });

    cameraButton = (Button) findViewById(R.id.cameraButton);
    cameraButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub

            final CharSequence[] items = {"カメラ", "ギャラリー"};

            AlertDialog.Builder builder = new AlertDialog.Builder(CardOrder.this);
            builder.setTitle("写真を撮る");
            builder.setItems(
                items,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int item) {
                    if (item == 0) {
                      Constants.fromGallery = false;
                      Intent takePicInt = new Intent(CardOrder.this, PhotoIntentActivity.class);
                      takePicInt.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                      startActivity(takePicInt);
                    } else {
                      Constants.fromGallery = true;
                      Intent takePicInt = new Intent(CardOrder.this, CameraCapture.class);
                      takePicInt.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
                      startActivity(takePicInt);
                    }
                  }
                });
            AlertDialog alert = builder.create();
            alert.show();
          }
        });

    homeButton = (Button) findViewById(R.id.homeButton);
    homeButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            try {
              if (CheckInternet.checkConn(CardOrder.this)) {
                Intent cardlistInt = new Intent(CardOrder.this, Home.class);
                cardlistInt.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
                startActivity(cardlistInt);

                finish();
              } /*else {
                	Toast.makeText(CardOrder.this,
                			"只今サーバに接続できません。しばらくしてから接続してください。",
                			Toast.LENGTH_SHORT).show();
                }*/
            } catch (Exception e) {
              Toast.makeText(CardOrder.this, e + "", Toast.LENGTH_LONG).show();
            }
          }
        });
  }
  @Override
  protected void onResume() {
    super.onResume();

    Constants.orderList.clear();
  }