private void myTitleDialog() { final Dialog setTitle = new Dialog(this); setTitle.setContentView(R.layout.titlesetter); setTitle.setTitle("Set Title Text"); db.open(); Cursor V = db.getRecord("title", 1); String title = V.getString(1); db.close(); final EditText newTitle = (EditText) setTitle.findViewById(R.id.setNewTitle); newTitle.setText(title); newTitle.requestFocus(); setTitle.show(); Button submitTitle = (Button) setTitle.findViewById(R.id.button2); submitTitle.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { String input = newTitle.getText().toString(); Log.i("titleTest", "-->" + input); try { db.open(); db.updateTitle(1, input); } catch (SQLException sqle) { throw sqle; } db.close(); vgp1.updateMain(); // mview.updateAll(); setTitle.dismiss(); } }); }
private void loadDatesV() { Log.i("Main", "MainLoadDB"); db.open(); Cursor V = db.getRecord("dates", 1); String[] StartDate = V.getString(1).split("/"); Sday = Integer.parseInt(StartDate[0]); Smonth = Integer.parseInt(StartDate[1]); Syear = Integer.parseInt(StartDate[2]); String[] EndDate = V.getString(2).split("/"); Eday = Integer.parseInt(EndDate[0]); Emonth = Integer.parseInt(EndDate[1]); Eyear = Integer.parseInt(EndDate[2]); db.close(); }
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(); } }