@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.test_image);

    im = (ImageView) findViewById(R.id.image1);
    compass = (CompassView) findViewById(R.id.compass);

    int width = im.getWidth();
    LogUtil.d("width= " + width);
    int height = im.getHeight();
    LogUtil.d("height= " + height);

    //		getScreenDIP();

    DisplayMetrics displayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    height = displayMetrics.heightPixels;
    width = displayMetrics.widthPixels;
    LogUtil.d("height: " + height);
    LogUtil.d("width: " + width);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, width);
    //		params.setMargins(margin, 0, margin, 0);
    //		params.rightMargin
    //		params.addRule(LinearLayout.ALIGN_PARENT_TOP);
    im.setLayoutParams(params);
  }
 private void insertDB() {
   LogUtil.d("insertDB");
   for (int i = 0; i < 5; i++) {
     Uri uri = MusicDB.MusicInfoColumns.getContentUri();
     LogUtil.d("uri= " + uri);
     ContentValues values = new ContentValues();
     values.put(MusicDB.MusicInfoColumns.MUSICNAME, "name_" + i);
     this.getContentResolver().insert(uri, values);
   }
 }
 private void update() {
   Uri uri = MusicDB.MusicInfoColumns.getContentUri();
   //		Uri newUri = ContentUris.withAppendedId(uri,MusicDBProvider.MUSICINFO_ITEM);
   ContentValues values = new ContentValues();
   values.put(MusicDB.MusicInfoColumns.MUSICNAME, "20xx");
   String where = MusicDB.MusicInfoColumns.MUSICNAME + " = ?";
   LogUtil.d("where= " + where);
   String[] selectionArgs = {"name_3"};
   getContentResolver().update(uri, values, where, selectionArgs);
 }
 private void queryOne() {
   Uri uri = MusicDB.MusicInfoColumns.getContentUri();
   String[] projection = {MusicDB.MusicInfoColumns.MUSICNAME};
   String where = MusicDB.MusicInfoColumns.MUSICNAME + " = ?";
   String[] selectionArgs = {"name_1"};
   Cursor c = getContentResolver().query(uri, projection, where, selectionArgs, null);
   while (c.moveToNext()) {
     String name = c.getString(c.getColumnIndex(MusicDB.MusicInfoColumns.MUSICNAME));
     LogUtil.d("name= " + name);
   }
 }
  private void query() {
    Uri uri = MusicDB.MusicInfoColumns.getContentUri();
    String[] projection = {MusicDB.MusicInfoColumns.MUSICNAME};

    Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
    String name = "";
    cursor.moveToFirst();
    for (int i = 0; i < cursor.getCount(); i++) {
      cursor.moveToPosition(i);
      name = cursor.getString(cursor.getColumnIndex(MusicDB.MusicInfoColumns.MUSICNAME));
      LogUtil.d("name= " + name);
      //			cursor.moveToNext();
    }
  }
  private void getScreenDIP() {
    // 获取屏幕密度(方法1)
    int screenWidth = getWindowManager().getDefaultDisplay().getWidth(); // 屏幕宽(像素,如:480px)
    int screenHeight = getWindowManager().getDefaultDisplay().getHeight(); // 屏幕高(像素,如:800p)

    LogUtil.d("  1----------  screenWidth=" + screenWidth + "; screenHeight=" + screenHeight);

    // 获取屏幕密度(方法2)
    DisplayMetrics dm = new DisplayMetrics();
    dm = getResources().getDisplayMetrics();

    float density = dm.density; // 屏幕密度(像素比例:0.75/1.0/1.5/2.0)
    int densityDPI = dm.densityDpi; // 屏幕密度(每寸像素:120/160/240/320)
    float xdpi = dm.xdpi;
    float ydpi = dm.ydpi;

    LogUtil.d("  2---------- xdpi=" + xdpi + "; ydpi=" + ydpi);
    LogUtil.d("  2---------- density=" + density + "; densityDPI=" + densityDPI);

    screenWidth = dm.widthPixels; // 屏幕宽(像素,如:480px)
    screenHeight = dm.heightPixels; // 屏幕高(像素,如:800px)

    LogUtil.d("  2----------  screenWidth=" + screenWidth + "; screenHeight=" + screenHeight);

    // 获取屏幕密度(方法3)
    dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);

    density = dm.density; // 屏幕密度(像素比例:0.75/1.0/1.5/2.0)
    densityDPI = dm.densityDpi; // 屏幕密度(每寸像素:120/160/240/320)
    xdpi = dm.xdpi;
    ydpi = dm.ydpi;

    LogUtil.d(" 3---------- xdpi=" + xdpi + "; ydpi=" + ydpi);
    LogUtil.d(" 3---------- density=" + density + "; densityDPI=" + densityDPI);

    int screenWidthDip = dm.widthPixels; // 屏幕宽(dip,如:320dip)
    int screenHeightDip = dm.heightPixels; // 屏幕宽(dip,如:533dip)

    LogUtil.d(
        "  3---------- screenWidthDip=" + screenWidthDip + "; screenHeightDip=" + screenHeightDip);

    screenWidth = (int) (dm.widthPixels * density + 0.5f); // 屏幕宽(px,如:480px)
    screenHeight = (int) (dm.heightPixels * density + 0.5f); // 屏幕高(px,如:800px)

    LogUtil.d("  3---------- screenWidth=" + screenWidth + "; screenHeight=" + screenHeight);
  }
  @Override
  public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    // TODO Auto-generated method stub
    LogUtil.d("adapter click position= " + position);
    ToastUtil.showShortToast(mContext, "position " + position);
    switch (position) {
      case 1:
        break;
      case 2:
        break;
      case 3:
        UICallBackController.showSpecialObjectFragment(mMain);

        break;
      case 4:
        break;
      case 5:
        break;
      case 6:
        break;
      default:
        break;
    }
  }
 protected void onStart() {
   LogUtil.d(TAG + " onStart() ");
 }
 protected void onResume() {
   LogUtil.d(TAG + " onResume() ");
 }
Exemple #10
0
 protected void onPause() {
   LogUtil.d(TAG + " onPause() ");
 }
Exemple #11
0
 private void initializeViews(Context context, AttributeSet attrs) {
   LogUtil.d(TAG + " initializeViews()");
   onCreateView(context, attrs);
 }
Exemple #12
0
 @Override
 protected void parse(String json) {
   LogUtil.d(TAG + " parse artist ");
 }
 @Override
 public void onWorkspaceClick(int current) {
   // TODO Auto-generated method stub
   LogUtil.d("onclick workspace");
 }