Skip to content

Instantly share code, notes, and snippets.

View Nouman16's full-sized avatar

Nouman Jamil Nouman16

View GitHub Profile
@Nouman16
Nouman16 / MyAsyncTask
Last active November 6, 2016 18:49
AsyncTask class to get JSON Response from web API
public class ConnectTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
StringBuilder stringBuilder = new StringBuilder();
// params stores url of the API in string format that is needed to be convert in URL it comes from your MainActivity from where you execute asynctask.
public class MainActivity extends AppCompatActivity {
Button buttonStart;
Button buttonStop;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);