Note that there are some explanatory texts on larger screens.

plurals
  1. POMy App is working fine on Emulator but not on android device
    primarykey
    data
    text
    <p>I created a slider where i parse data image url from xml which is also on server. My App is working fine on Emulator and I also place internet permission in manifest file. But that is not working in android device and unable to fetch data. please help me!</p> <pre><code>public class SliderActivity extends Activity{ int j=0; String imageList[]; ImageView imageview; Button next_button, prev_button; int no_of_slides; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); imageview = (ImageView) findViewById(R.id.imageView1); next_button= (Button) findViewById(R.id.next_button); prev_button= (Button) findViewById(R.id.prev_button); try{ /** This section is for xml parsing */ URL url = new URL("my url"); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("image"); imageList= new String[nodeList.getLength()]; no_of_slides=nodeList.getLength()-1; for (int i = 0; i &lt; nodeList.getLength(); i++) { Node node = nodeList.item(i); Element fstElmnt = (Element) node; NodeList nameList = fstElmnt.getElementsByTagName("image"); Element nameElement = (Element) nameList.item(0); nameList = nameElement.getChildNodes(); imageList[i]= ((Node) nameList.item(0)).getNodeValue(); } next_button.setOnClickListener(new clicker()); prev_button.setOnClickListener(new clicker()); }catch(Exception e){ System.out.println("Exception appears = " + e); } } class clicker implements Button.OnClickListener{ public void onClick(View v){ /** This section is for next button */ if(v==next_button){ if(j==no_of_slides) j=0; else j=j+1; try{ imageview.setImageDrawable(grabImageFromUrl(imageList[j])); }catch(Exception e){ System.out.println("Exception appears = " + e); } } else /** This section is for prev button */ if(v==prev_button){ if(j==0) j=no_of_slides; else j=j-1; try{ imageview.setImageDrawable(grabImageFromUrl(imageList[j])); }catch(Exception e){ System.out.println("Exception appears = " + e); } } } } /** This function is to fetch image from URL */ private Drawable grabImageFromUrl(String url) throws Exception { return Drawable.createFromStream((InputStream)new URL(url).getContent(), "src"); } } </code></pre> <h2>XML Structure</h2> <pre><code>&lt;images&gt; &lt;image&gt;http://www.xyz.com/1.jpeg&lt;/image&gt; &lt;image&gt;http://www.xyz.com/1.jpeg&lt;/image&gt; &lt;image&gt;http://www.xyz.com/1.jpeg&lt;/image&gt; &lt;/images&gt; </code></pre> <h2>The main cause of error</h2> <pre><code>11-09 10:08:56.103: E/System(61): Failure starting core service 11-09 10:08:56.103: E/System(61): java.lang.SecurityException 11-09 10:08:56.103: E/System(61): at android.os.BinderProxy.transact(Native Method) 11-09 10:08:56.103: E/System(61): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146) 11-09 10:08:56.103: E/System(61): at android.os.ServiceManager.addService(ServiceManager.java:72) 11-09 10:08:56.103: E/System(61): at com.android.server.ServerThread.run(SystemServer.java:176) </code></pre> <p>I get these messages in logcat.....</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload