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

    mViewGroup = (MyViewGroup) findViewById(R.id.test_view_group);

    ImageView imgView = new ImageView(this);
    imgView.setImageResource(R.drawable.sbook1);
    imgView.setPadding(0, 10, 0, 10);
    mViewGroup.addView(imgView);

    ImageView imgView2 = new ImageView(this);
    imgView2.setImageResource(R.drawable.sbook2);
    imgView2.setPadding(0, 10, 0, 10);
    mViewGroup.addView(imgView2);

    DisplayMetrics metrics = getResources().getDisplayMetrics();
    Log.e("TAG", "(" + metrics.widthPixels + "," + metrics.heightPixels + ")");

    /*
    int width = 1073742544;
    int height = 1073742862;

    int wMode = View.MeasureSpec.getMode(width);
    int wSize = View.MeasureSpec.getSize(width);

    int hMode = View.MeasureSpec.getMode(height);
    int hSize = View.MeasureSpec.getSize(height);

    Log.e("TAG", "wMode=" + wMode + ",wSize=" + wSize + ",hMode=" + hMode + ",hSize=" + hSize);
    */
  }
Beispiel #2
0
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = this;
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    vgp1 = new MyViewGroup(context);
    setContentView(vgp1);
    vgp1.setOnLongClickListener(
        new View.OnLongClickListener() {
          public boolean onLongClick(View view) {
            openOptionsMenu();
            return true;
          }
        });
    vgp1.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View view) {
            configDetails();
            info = true;
          }
        });
    db = new myDatabaseAdapter(context);
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
    viewGroup = (MyViewGroup) findViewById(R.id.myViewGroup);

    ImageView imageView = new ImageView(this);
    imageView.setImageDrawable(getResources().getDrawable(R.drawable.a1));
    viewGroup.addView(imageView);

    viewGroup.addView(View.inflate(this, R.layout.form, null));

    findViewById(R.id.Button01)
        .setOnClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View v) {
                // TODO Auto-generated method stub
                System.out.println("©ирт╣Ц╩В");
              }
            });

    imageView = new ImageView(this);
    imageView.setImageDrawable(getResources().getDrawable(R.drawable.a2));
    viewGroup.addView(imageView);

    pageControl = (PageControlView) findViewById(R.id.pageControl);
    pageControl.setCount(viewGroup.getChildCount());
    pageControl.generatePageControl(0);
    viewGroup.setScrollToScreenCallback(pageControl);
  }
Beispiel #4
0
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
      Uri selectedImage = data.getData();
      String[] filePathColumn = {MediaStore.Images.Thumbnails.DATA};
      Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
      cursor.moveToFirst();
      int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
      String picturePath = cursor.getString(columnIndex);
      cursor.close();
      Log.i("pic", picturePath);

      db.open();
      db.updatePic(1, picturePath);
      db.close();
      vgp1.updateMainPic();
    }
  }