Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this. This might solve your problem</p> <pre><code>private HandlingXMLReading doingWork; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_prediction); Past = (TextView) findViewById(R.id.textView1); Present = (TextView) findViewById(R.id.textView2); Future = (TextView) findViewById(R.id.textView3); doingWork = new HandlingXMLReading(); // created object of default handler class new GetPrediction().execute(); } class GetPrediction extends AsyncTask &lt;Void, String, String&gt; { ProgressDialog dialog = new ProgressDialog(Prediction.this); @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); dialog.setMessage("Getting your fortune"); dialog.setCancelable(false); dialog.show(); } @Override protected String doInBackground(Void... b) { // TODO Auto-generated method stub try { URL website = new URL(baseUrl); SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); xr.setContentHandler(doingWork); xr.parse(new InputSource(website.openStream())); past = doingWork.getPastPrediction(); present = doingWork.getPresentPrediction(); future = doingWork.getFuturePrediction(); } catch( Exception e) { past = e.getMessage(); present = e.getMessage(); future = e.getMessage(); } return past; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); dialog.dismiss(); Past.setText(result); Present.setText(present); Future.setText(future); } } </code></pre>
    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.
    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