Saving a new photo from the capture fragment
Open up the
CaptureFragment.java
file in the editor.
We need to add a new member variable for the CaptureFragment
class to hold our new DataManager
class instance.
Add the new highlighted member variable to CaptureFragment
, which we have just discussed:
public class CaptureFragment extends Fragment{ private static final int CAMERA_REQUEST = 123; private ImageView mImageView; // Where the captured image is stored private Uri mImageUri = Uri.EMPTY; // Where to save the image String mCurrentPhotoPath; // A reference to our database private DataManager mDataManager; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); }
Now, we can initialize the DataManager
instance ...
Get Android Programming for Beginners now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.