Code example for Fragment

Methods: getActivityonPause

0
        return rootView;
    } 
     
    @Override 
    public void onPause() { 
    	super.onPause(); 
    	updatePersonFromUI(); 
    } 
     
    private void updatePersonFromUI() { 
    	if (mItem != null) {
    		mItem.firstname = textFirstName.getText().toString();
    		mItem.lastname = textLastName.getText().toString();
    		mItem.bio = textBio.getText().toString();
    		 
    		DatabaseHandler.getInstance(getActivity()).putPerson(mItem);
        } 
    } 
}