Пример #1
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.folderex);

    Intent gintent = getIntent();
    getPath = gintent.getStringExtra("path");
    dbPath = gintent.getStringExtra("dbpath");

    FileList _FileList = new FileList(this);
    _FileList.setOnPathChangedListener(_OnPathChanged);
    _FileList.setOnFileSelected(_OnFileSelected);

    LinearLayout layout = (LinearLayout) findViewById(R.id.LinearLayout01);
    layout.addView(_FileList);

    Util.print("getPath = " + getPath);
    String path = " ";

    if (getPath.equals("empty")) {
      File root = Environment.getExternalStorageDirectory();
      _FileList.setPath(root.getAbsolutePath());
      path = root.getAbsolutePath();
    } else {
      _FileList.setPath(getPath);
      path = getPath;
    }

    Util.print("path = " + path);

    _FileList.setFocusable(true);
    _FileList.setFocusableInTouchMode(true);

    ((TextView) findViewById(R.id.TextView01)).setSelected(true);
  }
Пример #2
0
  public static String getDateStr() {
    // String year = Util.Int2Str(time.get(time.YEAR));
    // String month = Util.Int2Str(time.get(time.MONTH) + 1);
    // String day = Util.Int2Str(time.get(time.DAY_OF_MONTH));

    GregorianCalendar time = new GregorianCalendar();

    String t;

    int day = time.get(time.DAY_OF_WEEK);
    String conversionDay = null;
    switch (day) {
      case 1:
        conversionDay = "Sun";
        break;

      case 2:
        conversionDay = "Mon";
        break;

      case 3:
        conversionDay = "Tue";
        break;

      case 4:
        conversionDay = "Wed";
        break;

      case 5:
        conversionDay = "Thu";
        break;

      case 6:
        conversionDay = "Fri";
        break;

      case 7:
        conversionDay = "Sat";
    }

    t =
        Util.Int2Str(time.get(time.YEAR))
            + "."
            + String.format(String.format("%02d", time.get(time.MONTH) + 1))
            + "."
            + String.format("%02d", time.get(time.DAY_OF_MONTH))
            + " "
            + conversionDay;

    return t;
  }