public void saveProfile(View view) { Profile profile = new Profile(); TextView tv = (TextView) this.findViewById(R.id.et_fullname); String fullName = tv.getText().toString(); profile.setFullname(fullName); tv = (TextView) this.findViewById(R.id.et_email); String email = tv.getText().toString(); profile.setEmail(email); if (profileData.save(profile)) { Toast.makeText(this, "Saved!!", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, ProfileList.class); this.startActivity(intent); } else { Toast.makeText(this, "Error!!", Toast.LENGTH_LONG).show(); } }
@Override protected void onDestroy() { super.onDestroy(); profileData.close(); }
@Override protected void onResume() { super.onResume(); profileData = new ProfileData(this); profileData.open(); }