title: Android Set ImageView Source from Java
body: <p>I want to set an Image Source in Android,</p>
  
  <p>XML : </p>
  
  <pre><code> &lt;ImageView
      android:layout_width="200dp"
      android:layout_height="300dp"
      android:id="@+id/main"
      android:src="@drawable/malayali"
      android:layout_marginTop="100dp"
      android:layout_marginLeft="80dp"
      /&gt;
  </code></pre>
  
  <p>Java : </p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
    public SharedPreferences exactPreferences;
  
  
    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      exactPreferences = getSharedPreferences("details",MODE_PRIVATE);
  
      getSupportActionBar().hide();
  
      new RetriveIcon().execute();    //Api Calling &amp; Storing value in SharedPreference
  
      String value = exactPreferences.getString("main_url",null);
  
      Log.i("from exactpreference",value);  // Working fine !!!  (http://www.exampple.com/storage/images/filename.jpeg)
  
     ImageView banner = (ImageView)findViewById(R.id.main);
     banner.setImageDrawable(getResources().getDrawable(R.drawable.value));
  
      setContentView(R.layout.activity_main);
  
   }
  }
  </code></pre>
  
  <p>androidStudio showing error in the below line of value as red.</p>
  
  <pre><code>banner.setImageDrawable(getResources().getDrawable(R.drawable.value));
  </code></pre>
  
  <p>ERROR:</p>
  
  <pre><code>Cannot resolve symbol 'value'
  </code></pre>
  
  <p>How can I solve this Error ?</p>