package com.stylepoints.habittracker;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class EventNewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event_new);
    }
}

package com.stylepoints.habittracker;

import android.content.Intent;
import android.graphics.Bitmap;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import static android.app.Activity.RESULT_OK;

public class EventNewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event_new);
    }

    /**
     * Called when the user taps the Send button
     */
    public void takePhoto(View view) { //modify for photo
        // Do something in response to button
        int cap = 1;

        private void dispatchTakePictureIntent {
            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
                startActivityForResult(takePictureIntent, cap);
            }
        }

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            if (requestCode == cap && resultCode == RESULT_OK) {
               Bundle extras = data.getExtras();
                 imageBitmap = (Bitmap) extras.get("data");
                mImageView.setImageBitmap(imageBitmap);
            }
        }
    }








Add files via upload