I'm tying to read data from server I'm using xampp) but the data is empty this is my connect activity:
public String link="";
public AsyncTaskConnect(String link){
    this.link=link;
}
@Override
protected Object doInBackground(Object[] params) {
    try{
        URL url=new URL(link);
        URLConnection connection=url.openConnection();
        BufferedReader reader=new BufferedReader(new InputStreamReader(connection.getInputStream()));
        StringBuilder builder=new StringBuilder();
        String line=null;
        while((line=reader.readLine())!=null){
            builder.append(line);
        }
        MainActivity.data=builder.toString();
    }catch (Exception e){
    }
    return "";
}
this is main activity:
public static String data="";
TextView txthello;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    txthello=(TextView)findViewById(R.id.txthello);
    new AsyncTaskConnect("http://192.168.1.2/digikala/test.php").execute();
    txthello.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(MainActivity.this,data,Toast.LENGTH_LONG).show();
        }
    });
}
but it doesn't work, what should I do?
 
     
     
    