Using OnSuccessListener and then use a PrintStream in the method gets me an error
0
I'm using Google API to get the location of a device and I have to use OnSuccessListener but I tried to use a PrintStream so it sends the location when its successful but it gives me a NetworkOnMainThreadException I tried using handlers and I saw that i can use an AsyncTask but i dont know where, I really think the problem is the onSuccess but i couln't find anything that helped @Override public void onSuccess(Location location) { if(location != null){ Geocoder geocoder = new Geocoder(activityContext.getApplicationContext(), Locale.getDefault()); List<Address> addresses = null; try { addresses = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1); }...