Я получил исключение именно в этой строке и не могу понять, что с ним не так.
SecondsText.setText(Math.round(SecondsTime));
Это остальная часть кода:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
long AnDate = 1476650909;
TextView SecondsText = (TextView) findViewById(R.id.SecondsText);
TextView MinutesText = (TextView) findViewById(R.id.MinutesText);
TextView HoursText = (TextView) findViewById(R.id.HoursText);
TextView DaysText = (TextView) findViewById(R.id.DaysText);
long SecondsTime = System.currentTimeMillis()/1000 - AnDate;
long MinutesTime = SecondsTime/60;
long HoursTime = MinutesTime/60;
long DaysTime = HoursTime/24;
**SecondsText.setText(Math.round(SecondsTime));**
MinutesText.setText(Math.round(MinutesTime));
HoursText.setText(Math.round(HoursTime));
DaysText.setText(Math.round(DaysTime));
}
И исключение говорит:
> 10-12 15:32:25.920 9254-9254/com.example.mauro.howmuchtime E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mauro.howmuchtime, PID: 9254
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mauro.howmuchtime/com.example.mauro.howmuchtime.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x3bd011c
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2792)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6590)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x3bd011c
at android.content.res.Resources.getText(Resources.java:339)
at android.widget.TextView.setText(TextView.java:5496)
**at com.example.mauro.howmuchtime.MainActivity.onCreate(MainActivity.java:24)**
at android.app.Activity.performCreate(Activity.java:7023)
at android.app.Activity.performCreate(Activity.java:7014)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:172)
at android.app.ActivityThread.main(ActivityThread.java:6590)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
java.lang.Math импортируется, SecondsText представляет собой текстовое представлениеОбъект в Android Studio и SecondsTime - это длинная переменная, и я хочу удалить из нее десятичные дроби.Я знаю, что это действительно глупый вопрос, но не могу понять, я новичок в Java.Спасибо!