title: Imageview disappeared?
body: <p>I just made a fresh new project,but when I added an imageview to my layout and launched the emulator,
  I can't find it.My goal is,to make the user click the imageview then it directs him to the gallery then he chooses the pic and then it is saved in the database,as simple as that. But when I launch my app I just can't find the imageview.Any ideas on what is going on?</p>
  
  <p>Here is my layout:</p>
  
  <pre><code>&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
      &lt;ImageView
          android:id="@+id/imageVieww"
          android:layout_width="148dp"
          android:layout_height="160dp"
          app:layout_constraintBottom_toTopOf="@+id/Arabic"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.498"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          tools:srcCompat="@drawable/galboy" /&gt;
  
      &lt;EditText
          android:id="@+id/Arabic"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="Arabic"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:layout_constraintVertical_bias="0.268" /&gt;
  
      &lt;EditText
          android:id="@+id/Long"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="Long"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/English"
          app:layout_constraintVertical_bias="0.071" /&gt;
  
      &lt;EditText
          android:id="@+id/Mob"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="Mob"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/Lat"
          app:layout_constraintVertical_bias="0.072" /&gt;
  
      &lt;EditText
          android:id="@+id/user"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="Username"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/Mob"
          app:layout_constraintVertical_bias="0.103" /&gt;
  
      &lt;EditText
          android:id="@+id/pass"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="Pass"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/user"
          app:layout_constraintVertical_bias="0.144" /&gt;
  
      &lt;EditText
          android:id="@+id/Lat"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="Lat"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/Long"
          app:layout_constraintVertical_bias="0.075" /&gt;
  
      &lt;EditText
          android:id="@+id/English"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ems="10"
          android:hint="English"
          android:inputType="textPersonName"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintHorizontal_bias="0.497"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@+id/Arabic"
          app:layout_constraintVertical_bias="0.058" /&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <p>And here is where is call my imageview in the code:</p>
  
  <pre><code>imageoffarm.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              askFileReadPermission();
          }
      });
  }
  
  private void askFileReadPermission() {
      if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
          ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, READ_PERM_CODE);
      } else {
          Intent gallery = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
          startActivityForResult(gallery, GALLERY_REQUEST_CODE);
      }
  }
  
  @Override
  public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
      if (requestCode == CAMERA_PERM_CODE || requestCode == READ_PERM_CODE || requestCode == WRITE_PERM_CODE) {
          if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
              Intent gallery = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
              startActivityForResult(gallery, GALLERY_REQUEST_CODE);
          }
      } else {
          Toast.makeText(this, "الرجاء قبول الكميرة لاجل التصوير", Toast.LENGTH_SHORT).show();
      }
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
  
  
      if (requestCode == GALLERY_REQUEST_CODE) {
          if (resultCode == Activity.RESULT_OK) {
              Uri contentUri = data.getData();
              File imageFile = new File(getRealPathFromURI(MainActivity.this, contentUri));
              String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
              String imageFileName = "JPEG_" + timeStamp + "." + getFileExt(contentUri);
              DatabaseHelper databaseHelper = new DatabaseHelper(MainActivity.this);
              databaseHelper.SavingimagepathAR(Uri.fromFile(imageFile).getPath());
              Log.d("tag", "onActivityResult: Gallery Image Uri:  " + Uri.fromFile(imageFile));
              imageoffarm.setImageURI(contentUri);
  
  
          }
  
      }
  }
  
  
  private String getRealPathFromURI(Context context, Uri contentUri) {
      Cursor cursor = null;
      try {
          String[] proj = {MediaStore.Images.Media.DATA};
          cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
          int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
          cursor.moveToFirst();
          return cursor.getString(column_index);
      } catch (Exception e) {
          Log.e(TAG, "getRealPathFromURI Exception : " + e.toString());
          return "";
      } finally {
          if (cursor != null) {
              cursor.close();
          }
      }
  }
  
  private String getFileExt(Uri contentUri) {
      ContentResolver c = getContentResolver();
      MimeTypeMap mime = MimeTypeMap.getSingleton();
      return mime.getExtensionFromMimeType(c.getType(contentUri));
  }
  </code></pre>
  
  <p>Any help!?</p>