Skip to content

Commit

Permalink
Allow main thread to do I/O, although it has become deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
arndtjonasson committed Sep 5, 2017
1 parent 7937b56 commit 0a8b81f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import android.widget.Button;
import android.widget.EditText;

import android.os.StrictMode;

public class SocketConnector extends Activity {
private final static int CONNECTION_TIMEOUT = 3000;

Expand All @@ -23,7 +25,13 @@ public class SocketConnector extends Activity {
private Socket socket = null;

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);


StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

setContentView(R.layout.socket_connection_build);
ed_host = (EditText) findViewById(R.id.ed_host);
ed_port = (EditText) findViewById(R.id.ed_port);
Expand Down Expand Up @@ -114,7 +122,7 @@ protected void onPostExecute(String result) {
else {
new AlertDialog.Builder(SocketConnector.this)
.setTitle("notification")
.setMessage(msg)
.setMessage(msg + " " + result)
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
Expand Down

0 comments on commit 0a8b81f

Please sign in to comment.