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); }
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(); } }