title: How to progress into saving the image into SQLiteDatabase
body: <p>This is where I import the image to(from gallery) and I want to save it to SQLite to hopefully display it in another activity, how would I go about doing so? I am kind of new to Android Studio so if there is some newbie kind of easy way that I would go about doing so would be very helpful.
  (Update) So I have added this two lines marked by /* */ but now I can't get my app to work still have no idea how to do this.. any ideas?</p>
  <p>Import image&gt;Save to SQLite&gt;Take Image to SQLite&gt;Display in another activity</p>
  <pre><code>import androidx.annotation.NonNull;
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.core.app.ActivityCompat;
  import androidx.core.content.ContextCompat;
  
  import android.Manifest;
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.database.Cursor;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.graphics.drawable.BitmapDrawable;
  import android.location.Address;
  import android.location.Geocoder;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Build;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Locale;
  
  public class DataInput extends AppCompatActivity {
  
      private EditText inputName;
      private EditText inputAge;
      private Button buttonSave;
      private Button buttonGetLocation;
  
      private Button buttonImportImage;
      private ImageView mImageView;
  
      private static final int IMAGE_PICK_CODE = 1000;
      private static final int PERMISSION_CODE = 1001;
  
      private InputHelper helper = null;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_data_input);
  
          inputName = (EditText) findViewById(R.id.input_name);
          inputAge = (EditText) findViewById(R.id.input_age);
          address = (TextView) findViewById(R.id.address);
          buttonSave = findViewById(R.id.button_save);
          buttonSave.setOnClickListener(onSave);
  
          buttonImportImage = findViewById(R.id.button_import_image);
          mImageView = findViewById(R.id.image_view);
          buttonImportImage.setOnClickListener(onImport);
  
          helper = new InputHelper(this); }
  
      private View.OnClickListener onSave = new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              String nameStr = inputName.getText().toString();
              String ageStr = inputAge.getText().toString();
              String addressStr = address.getText().toString();
  
              String combineStr = nameStr + &quot;\n&quot; + ageStr + &quot;\n&quot; + addressStr;
              Toast.makeText(v.getContext(), combineStr, Toast.LENGTH_LONG).show();
  
  /*BitmapDrawable drawable = (BitmapDrawable)mImageView.getDrawable();
  Bitmap bitmap = drawable.getBitmap();
  byte[] image = getBitmapAsByteArray(bitmap);*/
  
              Intent i = new Intent(DataInput.this,InformationDisplay.class);
              startActivity(i);
  
              helper.insert(nameStr,ageStr,addressStr,image);
  
              finish();
          }
  
    /*  public byte[] getBitmapAsByteArray(Bitmap bitmap) {
          ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
          bitmap.compress(Bitmap.CompressFormat.PNG, 0, outputStream);
          return outputStream.toByteArray(); */
      }
  };
  
  
      private View.OnClickListener onImport = new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              //check runtime permission
              if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
                  if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
                          == PackageManager.PERMISSION_DENIED) {
                      //permission not granted, request it.
                      String[] permissions = {Manifest.permission.READ_EXTERNAL_STORAGE};
                      //show popup for runtime permission
                      requestPermissions(permissions, PERMISSION_CODE);
                  } else {
                      //permission already granted
                      pickImageFromGallery();
                  }
              } else {
                  //system os is less then marshmallow
                  pickImageFromGallery();
              }
          }
      };
  
      private void pickImageFromGallery() {
          //intent to pick image
          Intent intent = new Intent(Intent.ACTION_PICK);
          intent.setType(&quot;image/*&quot;);
          startActivityForResult(intent, IMAGE_PICK_CODE);
      }
  
      //handle result of runtime permission
      @Override
      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
          super.onRequestPermissionsResult(requestCode, permissions, grantResults);
          switch (requestCode) {
              case PERMISSION_CODE: {
                  if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] ==
                          PackageManager.PERMISSION_GRANTED) {
                      //permission was granted
                      pickImageFromGallery();
                  } else {
                      //permission was denied
                      Toast.makeText(this, &quot;Permission denied...!&quot;, Toast.LENGTH_LONG).show();
                  }
              }
          }
      }
      //handle  result of picked image
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (resultCode == RESULT_OK &amp;&amp; requestCode == IMAGE_PICK_CODE) {
              //set image to image view
              mImageView.setImageURI(data.getData());
          }
      }
  </code></pre>