List of usage examples for org.jsoup.nodes Element getElementById
public Element getElementById(String id)
From source file:com.normalexception.app.rx8club.fragment.UserCpFragment.java
/** * Construct the main view for our user profile *///from www. ja va 2s . c om private void constructView() { AsyncTask<Void, String, Void> updaterTask = new AsyncTask<Void, String, Void>() { @Override protected void onPreExecute() { loadingDialog = ProgressDialog.show(getActivity(), getString(R.string.loading), getString(R.string.pleaseWait), true); } @Override protected Void doInBackground(Void... params) { try { Document doc = VBForumFactory.getInstance().get(getActivity(), WebUrls.editProfile); if (doc != null) { token = HtmlFormUtils.getInputElementValueByName(doc, "securitytoken"); Elements fieldSets = doc.select("fieldset[class=fieldset]"); publishProgress(getString(R.string.asyncDialogPopulating)); for (Element fieldSet : fieldSets) { String legend = fieldSet.select("legend").text(); if (legend.equals("Custom User Title")) { customTitle = fieldSet.select("strong").text(); continue; } else if (legend.equals("Home Page URL")) { homepageurl = fieldSet.getElementById("tb_homepage").attr("value"); continue; } else if (legend.equals("Biography")) { biography = fieldSet.getElementById("ctb_field1").attr("value"); continue; } else if (legend.equals("Location")) { location = fieldSet.getElementById("ctb_field2").attr("value"); continue; } else if (legend.equals("Interests")) { interests = fieldSet.getElementById("ctb_field3").attr("value"); continue; } else if (legend.equals("Occupation")) { occupation = fieldSet.getElementById("ctb_field4").attr("value"); continue; } } updateView(); } } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } return null; } @Override protected void onProgressUpdate(String... progress) { if (loadingDialog != null) loadingDialog.setMessage(progress[0]); } @Override protected void onPostExecute(Void result) { try { loadingDialog.dismiss(); loadingDialog = null; } catch (Exception e) { Log.w(TAG, e.getMessage()); } } }; updaterTask.execute(); }