title: How to get XML data from assets in android?
body: <p>I have stored an XML file in assets folder, and I want to retrieve data XML file which I stored in assets in android, give me a solution.</p>
  
  <pre><code>&lt;Response&gt;
      &lt;RequestID&gt;1001&lt;/RequestID&gt;
      &lt;FunctionStatus&gt;&lt;/FunctionStatus&gt;   
      &lt;Message&gt;&lt;/Message&gt;
  
  &lt;Result&gt;    
      &lt;Banner&gt;
  
      &lt;Banner_List&gt;
          &lt;Banner_id&gt;3794&lt;/Banner_id&gt;
          &lt;Banner_url&gt;http://www.metromatinee.com/agile_dogs/05.jpg&lt;/Banner_url&gt;
          &lt;Movie_name&gt;Rose Guitarinaal&lt;/Movie_name&gt;
          &lt;gender&gt;Movie&lt;/gender&gt;
      &lt;/Banner_List&gt; 
  &lt;/Response&gt;  
  </code></pre>
  
  <p>I tried<br> <code>InputStream is = getAssets().open("demo.xml");</code> <br><br>
  but exception caused <br>
  any help..???</p>
  
  <pre><code>03-27 11:03:04.939: E/AndroidRuntime(432): FATAL EXCEPTION: main
  03-27 11:03:04.939: E/AndroidRuntime(432): java.lang.NullPointerException
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.content.ContextWrapper.getAssets(ContextWrapper.java:74)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at com.service.example.DemoBussinessExecutePage.executeBussinessFunction(DemoBussinessExecutePage.java:230)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at com.service.example.Service_Manager.executeBussinessFunction(Service_Manager.java:38)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at com.service.example.Service_class$1.onClick(Service_class.java:57)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.view.View.performClick(View.java:2408)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.view.View$PerformClick.run(View.java:8816)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.os.Handler.handleCallback(Handler.java:587)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.os.Handler.dispatchMessage(Handler.java:92)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.os.Looper.loop(Looper.java:123)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at java.lang.reflect.Method.invokeNative(Native Method)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at java.lang.reflect.Method.invoke(Method.java:521)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  03-27 11:03:04.939: E/AndroidRuntime(432):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>