I'want to update my UI from another class PrayerTime.java
.
First Method :
I used this and I got (cannot resolve methode findViewById(int)
error
PrayerTime.java :
protected void onPostExecute(String s) {
TextView rs = (TextView) findViewById(R.id.result);
rs.setText(s);
}
Seconde Method :
In PrayerTime.java
I made this :
public class PrayerTime extends AsyncTask<String, String, String> {
public String fr = null;
..
protected void onPostExecute(String s) {
this.fr = s;
}
And in MainActivity.java
:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
PrayerTime pr = new PrayerTime();
pr.execute();
TextView rs = (TextView) findViewById(R.id.result);
rs.setText(pr.fr);
}
Here no error is shown but Also the Textview is not updated after The AsynTask is done.
I need you'r help to correct this or find another solution to update my UI