のTextViewに出力します!
パブリッククラスMainActivityがAppCompatActivity {
TextView text;
TextView text2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView) findViewById(R.id.textView9);
text2 = (TextView) findViewById(R.id.textView8);
Button btn1 = (Button) findViewById(R.id.btn1);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new doit().execute();
}
});
}
public class doit extends AsyncTask<Void, Void, Void> {
String words;
String currentString;
String date;
@Override
protected Void doInBackground(Void... params) {
try {
Document doc = Jsoup.connect("http://www.hawlergov.org/en/currency.php").get();
words = doc.text();
currentString = words;
} catch (Exception e) {
e.printStackTrace();
}
String first = words;
String roar = first.substring(718, 730);
words=roar;
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
String currentDate = new SimpleDateFormat("MM-dd-yyyy", Locale.getDefault()).format(new Date());
text2.setText(currentDate);
text.setText(words);
}
}
here is the example
の可能性のある重複拡張[アンドロイドでHTMLを解析する方法を?](http://stackoverflow.com/questions/6126680/how-to -parse-a-html-in-android) –
[ask] with [mcve] –
本当にHTMLを解析しますか?通貨換算のためのAPIがあります。 –