-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathActivity.java
More file actions
61 lines (47 loc) · 1.56 KB
/
Activity.java
File metadata and controls
61 lines (47 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package nome.do.pacote;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.EditText;
import org.jsoup.Jsoup;
import org.jsoup.helper.HttpConnection;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.IOException;
public class NomeDaActivity extends AppCompatActivity {
EditText caixaTexto;
private StringBuilder retornoConexao;
private Handler handler = new Handler();
ConexaoThread conexaoT;
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
verificarTerminoConexao();
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.nome_da_activity);
setTitle("Título da Activity");
caixaTexto = findViewById(R.id.caixaTexto);
// ConexaoJsoup conexao = new ConexaoJsoup(this);
// conexao.doInBackground();
conexaoT = new ConexaoThread(this);
}
void receberStringBuilder(StringBuilder retorno) {
this.retornoConexao = retorno;
}
private void verificarTerminoConexao() {
if (conexaoT.isAlive()) {
verificarTerminoConexao();
} else {
if (retornoConexao != null) {
caixaTexto.setText(retornoConexao);
} else {
caixaTexto.setText("Não foi possível estabelecer conexão com o servidor.");
}
}
}
}
}
}