FileInputStream in = null; InputStreamReader inputStreamReader = new InputStreamReader(in);
I think the problem is here: you add a FileInputStream that is NULL in the InputStreamReader .
Also your code is more dirty. Look at here
tv1 = (TextView) findViewById(R.id.tv1); tv1.setText("Response : " + Risposta);
You are trying to update the UI from the workflow , so if you fix the first problem, the next problem will be the following.
You cannot activate the user interface from a workflow . This is not allowed. Only the origin stream (UI) can perform user interface operations.
So, if you want to get it working, you need to use runOnUiThread () , which is already running in the user interface thread instead of the regular thread.
Note. . To improve the code, I recommend that you use AsyncTask to perform actions on the Internet, as well as to update the user interface during / after some actions. AsyncTask is for things like yours. Here is a good Lars Vogel tutorial if you will never implement it before.
source share