Android fixed the problem of invalid title in AsyncTask's onPostExecute

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

Aug.09,2021

should be setTitle () is partly wrong. Does your toolbar always show the name of APP?
modify title:

getSupportActionBar().setTitle("");
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b41c43-2c5c3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b41c43-2c5c3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?