problem description
as mentioned, it is invalid to modify Title in the onPostExecute of AsyncTask without any errors
related codes
onCreate:
toolbar=(Toolbar) findViewById(R.id.main_toolbar);
setSupportActionBar(toolbar);
Simple simple=new Simple();
simple.execute("");
AsyncTask:
private class Simple extends AsyncTask<String,String,String>
{
@Override
protected void onPreExecute()
{
setTitle("...");
super.onPreExecute();
}
@Override
protected String doInBackground(String[] p1)
{
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{}
return "";
}
@Override
protected void onPostExecute(String result)
{
super.onPostExecute(result);
setTitle(result);
}
the environmental background of the problems and what methods you have tried
setTitle in onPostExecute has tried toolbar.setTitle and MainActivity.this.setTitle