Created
February 14, 2017 17:13
-
-
Save vinayakakv/3d4704dc2e63bb7e2b536805350c7e20 to your computer and use it in GitHub Desktop.
Handling Task Completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.vinayaka.test; | |
import android.app.ProgressDialog; | |
import android.os.AsyncTask; | |
import android.support.v7.app.AlertDialog; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.Toast; | |
import com.sigmaV5.FetchResult.*; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Button b = (Button) findViewById(R.id.okBtn); | |
b.setOnClickListener(v -> { | |
try { | |
AsyncTask<Void,Void,String> task = new ResultFetchTask(this, result -> new AlertDialog.Builder(MainActivity.this).setMessage(result).show()).execute(); | |
//Lambdas! | |
} | |
catch (Exception e){ | |
Log.e("MU","as",e); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment