I am trying to display Json data extracted from open weather map api and find it in the logcat.After successful build and installation of the app.I am getting this error.The error is Access denied finding property "persist.vendor.log.tel_dbg"
public class MainActivity extends AppCompatActivity {
EditText mEditText;
TextView mTextView;
String api="http://api.openweathermap.org/data/2.5/weather?
q=kolkata&appid=e8cd0e5f8d3ba1e87d108da87d9c0a94";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DownloadTask task=new DownloadTask();
task.execute(api);
}
public class DownloadTask extends AsyncTask<String,Void,String>
{
@Override
protected String doInBackground(String... urls) {
String result="";
URL url;
HttpURLConnection urlConnection=null;
try {
url=new URL(urls[0]);
urlConnection=(HttpURLConnection)url.openConnection();
InputStream in=urlConnection.getInputStream();
InputStreamReader reader=new InputStreamReader(in);
int data=reader.read();
while (data!=-1)
{
char current=(char)data;
result+=current;
data=reader.read();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return result;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
Log.i("Result",result);
}
}
}