|
@@ -16,6 +16,12 @@ import android.os.Bundle;
|
16
|
16
|
import android.telephony.TelephonyManager;
|
17
|
17
|
import android.util.Log;
|
18
|
18
|
import android.widget.TextView;
|
|
19
|
+import java.io.BufferedInputStream;
|
|
20
|
+import java.io.BufferedReader;
|
|
21
|
+import java.io.FileNotFoundException;
|
|
22
|
+import java.io.FileReader;
|
|
23
|
+import java.io.IOException;
|
|
24
|
+import java.io.InputStreamReader;
|
19
|
25
|
import java.util.Arrays;
|
20
|
26
|
|
21
|
27
|
/**
|
|
@@ -35,8 +41,25 @@ public class MainActivity extends Activity {
|
35
|
41
|
|
36
|
42
|
setContentView(R.layout.main);
|
37
|
43
|
|
|
44
|
+ int lines = 0;
|
|
45
|
+
|
|
46
|
+ try {
|
|
47
|
+ String line;
|
|
48
|
+ BufferedReader reader =
|
|
49
|
+ new BufferedReader(new InputStreamReader(openFileInput("sensors.log")));
|
|
50
|
+
|
|
51
|
+ while ((line = reader.readLine()) != null) {
|
|
52
|
+ lines++;
|
|
53
|
+ }
|
|
54
|
+ } catch (FileNotFoundException ex) {
|
|
55
|
+ lines = -1;
|
|
56
|
+ } catch (IOException ex) {
|
|
57
|
+ lines = -2;
|
|
58
|
+ }
|
|
59
|
+
|
38
|
60
|
((TextView) findViewById(R.id.text)).setText(
|
39
|
|
- ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId());
|
|
61
|
+ ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId()
|
|
62
|
+ + " -- " + getFileStreamPath("sensors.log") + " -- " + lines);
|
40
|
63
|
}
|
41
|
64
|
|
42
|
65
|
}
|