title: Imageview is picked up as circleimageview and doesn't display selected image
body: <p>I've been struggling for days now with displaying a selected picture on an imageview, all I need is that when a user selects or take a picture, the image should be displayed in my imageview inside my fragment, for now nothing happens and for some reason android studio picks up my imageview as a circleimageview, not sure if that could be the issue though, I've gone through Imageview problems in here and I couldn't find any relation to my problem cos I wanna avoid asking something that's already been answered, if it has please forgive me but I really need the help with this I am stuck, thank you in advance hey -).</p>
  
  <p>Here's my fragment xml</p>
  
  <pre><code>&lt;RelativeLayout 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"
      android:id="@+id/enquirefragment"
      tools:context="com.infamuspips.cess.enquire_Fragment"&gt;
  
  
      &lt;de.hdodenhof.circleimageview.CircleImageView
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:layout_marginTop="0dp"
          android:gravity="center"
          android:layout_centerHorizontal="true"
          android:padding="0dp"
          android:src="@drawable/app_icon"
          android:id="@+id/app_icon"
          /&gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Community "
          android:id="@+id/app_title"
          android:textColor="#000"
          android:textSize="18dp"
          android:layout_below="@+id/editText3"
          android:layout_centerHorizontal="true" /&gt;
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Engagement Surveilance "
          android:id="@+id/app_title1"
          android:layout_centerHorizontal="true"
          android:textColor="#000"
          android:layout_marginTop="5dp"
          android:textSize="18dp"
          android:layout_below="@+id/app_title"
          /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Please Log your question! "
          android:id="@+id/register"
          android:textColor="?attr/colorPrimary"
          android:layout_marginTop="10dp"
          android:textSize="15dp"
          android:layout_below="@+id/app_title1"
          /&gt;
  
      &lt;ImageView
          android:layout_width="300dp"
          android:layout_height="300dp"
          android:padding="5dp"
          android:id="@+id/imageView"
          android:background="#FFF"
          android:layout_alignParentTop="false"
          android:layout_centerVertical="true"
          android:layout_alignRight="@+id/app_title1"
          android:layout_alignEnd="@+id/app_title1" /&gt;
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="Click to use image for questioning"
          android:layout_centerHorizontal="true"
          android:textColor="?attr/colorPrimary"
          android:textStyle="italic"
          android:textSize="15dp"
          android:clickable="true"
          android:layout="@+id/imageView"
          android:id="@+id/questioning"
          android:layout_below="@+id/imageView"
          android:layout_alignLeft="@+id/imageView"
          android:layout_alignRight="@+id/app_title1" /&gt;
  
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/editText1"
          android:enabled="false"
          android:layout_above="@+id/logIn"
          android:layout_marginTop="25dp"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true" /&gt;
  
  
      &lt;EditText
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:inputType="textPassword"
          android:ems="10"
          android:id="@+id/editText3"
          android:layout_marginTop="29dp"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true" /&gt;
  
      &lt;EditText
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:inputType="textPassword"
          android:ems="10"
          android:id="@+id/editText4"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginBottom="35dp"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true" /&gt;
  
      &lt;EditText
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/enquire"
          android:layout_marginTop="10dp"
          android:layout_below="@+id/questioning"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_alignBottom="@+id/editText4" /&gt;
  
      &lt;AutoCompleteTextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/autocomplete"
          android:ems="10"
          android:hint = "module name"
          android:lines="1"
          android:singleLine="true"
          android:completionThreshold="1"
          android:layout_below="@+id/app_title1"
          android:layout_toEndOf="@+id/app_title1"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:layout_toRightOf="@+id/app_title1" /&gt;
  
      &lt;Button
          style="?android:attr/buttonStyleSmall"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Submit"
          android:id="@+id/btnSubmit"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:layout_below="@+id/enquire"
          android:layout_alignLeft="@+id/autocomplete"
          android:layout_alignStart="@+id/autocomplete" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Here's my methods within my Fragment class</p>
  
  <pre><code>     public class enquire_Fragment extends Fragment {
  
           @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          RelativeLayout enquire = (RelativeLayout) inflater.inflate(R.layout.fragment_enquire_, container, false);
          return Myview;
      }
  
         public void onActivityCreated (Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          //Run Background Activity
          Module = (AutoCompleteTextView) getActivity().findViewById(R.id.autocomplete);
          GetModules getmodules = new GetModules();
          getmodules.execute();
          //Find ChildObjects
          up = (EditText) getActivity().findViewById(R.id.editText3);
          down = (EditText) getActivity().findViewById(R.id.editText4);
          enquire = (EditText) getActivity().findViewById(R.id.enquire);
          que = (TextView) getActivity().findViewById(R.id.questioning);
          imageView = (ImageView)  getActivity().findViewById(R.id.imageView);
          button = (Button) getActivity().findViewById(R.id.btnSubmit);
          //Set attributes
          up.setEnabled(false);
          down.setEnabled(false);
          que.setClickable(true);
          button.setEnabled(false);
          Module.requestFocus();
          Module.addTextChangedListener(textwatcher);
          enquire.addTextChangedListener(textwatcher);
  
          //Call operations
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
              }
          });
          que.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  selectImage();
              }
          });
      }
  
  
       private void selectImage() {
  
          final CharSequence[] options = { "Take Photo", "Choose from Gallery","Cancel" };
  
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          builder.setTitle("Add Photo!");
          builder.setItems(options, new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int item) {
                  if (options[item].equals("Take Photo"))
                  {
                      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                      //File f = new File(android.os.Environment.getExternalStorageDirectory(), "temp.jpg");
                      //intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
                      startActivityForResult(intent, 1);
                  }
                  else if (options[item].equals("Choose from Gallery"))
                  {
                      Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                      startActivityForResult(Intent.createChooser(intent, "Select File"),2);
  
                  }
                  else if (options[item].equals("Cancel")) {
                      dialog.dismiss();
                  }
              }
          });
          builder.show();
      }
  
      //@Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (resultCode == getActivity().RESULT_OK) {
              if (requestCode == 1) {
                  File f = new File(Environment.getExternalStorageDirectory().toString());
                  for (File temp : f.listFiles()) {
                      if (temp.getName().equals("temp.jpg")) {
                          f = temp;
                          break;
                      }
                  }
                  try {
                      Bitmap bitmap;
                      BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
                      bitmap = BitmapFactory.decodeFile(f.getAbsolutePath(),
                              bitmapOptions);
                      imageView.setImageBitmap(bitmap);
  
                      String path = android.os.Environment
                              .getExternalStorageDirectory()
                              + File.separator
                              + "Phoenix" + File.separator + "default";
                      f.delete();
                      OutputStream outFile = null;
                      File file = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
                      try {
                          outFile = new FileOutputStream(file);
                          bitmap.compress(Bitmap.CompressFormat.JPEG, 85, outFile);
                          outFile.flush();
                          outFile.close();
                      } catch (FileNotFoundException el) {
                          el.printStackTrace();
                      } catch (IOException e) {
                          e.printStackTrace();
                      } catch (Exception ex) {
                          ex.printStackTrace();
                      }
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              } else if (requestCode == 2) {
                  Uri selectedImage = data.getData();
                  String[] filePath = { MediaStore.Images.Media.DATA };
                  Cursor c = getActivity().getContentResolver().query(selectedImage,filePath, null, null, null);
                  c.moveToFirst();
                  int columnIndex = c.getColumnIndex(filePath[0]);
                  String picturePath = c.getString(columnIndex);
                  c.close();
                  Bitmap thumbnail = (BitmapFactory.decodeFile(picturePath));
                  //Log.w(getActivity()"path of image from gallery......******************.........", picturePath+"");
                  ((BitmapDrawable)imageView.getDrawable()).getBitmap().recycle();
                  imageView.setImageBitmap(thumbnail);
  
              }
          }
      }
  </code></pre>
  
  <p>Here's my manifest</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.infamuspips.cess"&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
      &lt;uses-feature android:name="android.hardware.camera" /&gt;
      &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".registration"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".reg_name"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".reg_securityquestions"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".reg_id"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".reg_cellnumber"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".reg_email"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".reg_password"
              android:label="@string/app_name"&gt;&lt;/activity&gt;
          &lt;activity
              android:name=".Maindrawer"
              android:label="@string/title_activity_maindrawer"
              android:theme="@style/AppTheme"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Here are my gradle file-</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 22
      buildToolsVersion "22.0.1"
  
      defaultConfig {
          applicationId "com.infamuspips.cess"
          minSdkVersion 14
          targetSdkVersion 22
          versionCode 1
          versionName "1.0"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      testCompile 'junit:junit:4.12'
  
      compile 'com.android.support:appcompat-v7:22.2.1'
      compile 'com.android.support:design:22.2.1'
      compile 'de.hdodenhof:circleimageview:1.3.0'
      compile 'io.realm:realm-android:0.84.1'
      compile 'com.android.support:support-v4:22.2.1'
  }
  </code></pre>