Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Login extends AppCompatActivity {
- EditText usuario, senha;
- FrameLayout framePB;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_login);
- this.usuario = findViewById(R.id.edittextUsuario);
- this.senha = findViewById(R.id.edittextSenha);
- this.framePB = findViewById(R.id.framelayoutProgressBar);
- }
- public void buttonLogin(View view) {
- AsyncLogin login = new AsyncLogin(this.framePB, this.usuario.toString, this.senha.toString);
- login.execute();
- }
- public class AsyncLogin extends AsyncTask<String, String, String> {
- String usuario, senha;
- FrameLayout framePB;
- public AsyncLogin(FrameLayout framePB, String usuario, String senha) {
- this.framePB = framePB;
- this.usuario = usuario;
- this.senha = senha;
- }
- ...
- }
- public class Login extends AppCompatActivity {
- public void buttonLogin(View view) {
- String retorno = "";
- AsyncLogin login = new AsyncLogin(this.framePB, this.usuario.toString, this.senha.toString);
- login.execute();
- try {
- retorno = login.get();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (ExecutionException e) {
- e.printStackTrace();
- }
- Toast.makeText(this, retorno, Toast.LENGTH_SHORT).show();
- }
- }
Add Comment
Please, Sign In to add comment