James MV
James MV

Reputation: 8717

Publish progress?

Why is this not valid according to eclipse:

        protected String doInBackground(String... arg0) {

            publishProgress(10);  

            if(true){
                //validate with DB
            }else{
                //send to registration screen
            }

            return null;
        }

        //Update Progress       
        protected void onProgressUpdate(Integer... values) {

            mProgress.setProgress(values[0]);

        }

Eclipse is saying this:

publishProgress(10);  <<publishProgress(Void) is not acceptable for type publishProgress(Int)

However other questions on here show it used in that exact way. Is it a change in the API? I really want to pass publishProgress a string and and int. Is this possible:

publishProgress("Starting Validation", 10);  

TIA

Upvotes: 1

Views: 4922

Answers (1)

Eng.Fouad
Eng.Fouad

Reputation: 117627

Make sure you are declaring the right type in the generic parameters, something like:

new AsyncTask()<Void, Integer, Void>{ ...

AsyncTask<Params, Progress, Result>:

Upvotes: 17

Related Questions