I am new in this
I want to send data from my android phone to my computer
if i run it on my android phone it says android.os.NetworkOnMainThreadException
can someone help me ?
public void OnClick1(View v) {
try{
Socket s=new Socket("localhost",4445);
DataOutputStream dout =new DataOutputStream(s.getOutputStream());
dout.writeUTF("hello");
dout.flush();
dout.close();
s.close();
} catch (Exception e){
System.out.println(e);
}
}