java - Cannot find symbol method - tabbed acivity -
i want create live timer for tabbed activity.
however, error get:
error:(29, 38) error: cannot find symbol method runonunithread()
this code:
package com.example.sci.livetimeanddate; import android.icu.text.simpledateformat; import android.os.build; import android.support.annotation.nullable; import android.support.annotation.requiresapi; import android.support.v4.app.fragment; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.button; import android.widget.textview; import android.widget.toast; public class sub_page01 extends fragment { private static final string tag = "sub_page01"; @nullable @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { final view view = inflater.inflate(r.layout.fragment_sub_page01,container,false); thread t = new thread() { public void run() { try { while (!isinterrupted()) { thread.sleep(1000); getactivity().runonunithread(new runnable() { @requiresapi(api = build.version_codes.n) public void run() { textview tdate = (textview) view.findviewbyid(r.id.date); long date = system.currenttimemillis(); simpledateformat sdf = new simpledateformat("mmm dd yyyy\nhh-mm-ss a"); string datestring = sdf.format(date); tdate.settext(datestring); } }); } } catch (interruptedexception e) { } } }; t.start(); return view; } } i'm not sure problem is.
you have typo in runonunithread. there should runonuithread
Comments
Post a Comment