RYS
- Forum posts: 1
Dec 12, 2016, 5:49:56 AM via Website
Dec 12, 2016 5:49:56 AM via Website
Hello,
Is it possible to get the values of "i" set inside inner class method onPostTask method and print that
values in the outclass Oncreate method ?
package com.test
import android.os.AsyncTask;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
public static int i;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new JSONTask().execute("Test");
System.out.println("Value=" + i);
}
public class JSONTask extends AsyncTask<String, String, String> {
@Override
protected String doInBackground (String...params){
return null;
}
@Override
protected void onPostExecute (String result){
super.onPostExecute(result);
i=5;
}
}
}
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.