如标题所述,为什么我看不到System.out.println
LogCat 中的输出?这是我的代码,不起作用。我使用 Android Studio (v.0.8.2)。
编辑:将 log.i 添加到代码中不会在 logcat 中返回任何内容。
这是我的日志
这是我的代码
private static final String TAG = "MyActivity";
/*
*/
public void mButton(View view) {
URLConnection nbpUrl;
String data = "";
try {
nbpUrl = new URL("http://www.nbp.pl/Kursy/xml/dir.txt").openConnection();
InputStream is = nbpUrl.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String inputLine;
while ((inputLine = reader.readLine()) != null) {
if (inputLine.startsWith("a") && inputLine.endsWith("140807")) {
System.out.println(inputLine);
data = inputLine;
Log.i(TAG, "test");
}
}
is.close();
}
catch(Exception e){
e.printStackTrace();
}
poleTextowe = (TextView)findViewById(R.id.pole1);
poleTextowe.setText(data);
}
最佳答案
不要使用系统输出 println。 Android有自己的Logger类(class)。请参阅该文档。
关于java - 为什么我在LogCat中看不到System.out.println?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25263892/