title: create drawable from xml file
body: <p>I am working with map and trying to create marker as Drawable object from my layout file.
  I need my marker view to change depends on the the type of point, and hence i declared my first image as static and my second image as dynamic(Change dynamically),but it is not working.</p>
  
  <p>My layout file </p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    &lt;ImageView
      android:id="@+id/marker"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/marker" &gt;
    &lt;/ImageView&gt;
  
    &lt;ImageView
      android:id="@+id/category"
      android:layout_width="10dp"
      android:layout_height="10dp"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:src="@drawable/category_for_children" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>Resources res = getResources();
  try {
    marker = Drawable.createFromXml(res, res.getXml(R.layout.marker_on_map));
  } catch (NotFoundException e) {
    e.printStackTrace();
  } catch (XmlPullParserException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  }
  </code></pre>