我是android的新手。我无法显示toast。
val configBuilder = FirebaseRemoteConfigSettings.Builder()
if (BuildConfig.DEBUG) {
val cacheInterval: Long = 0
configBuilder.setMinimumFetchIntervalInSeconds(cacheInterval)
}
答案 0 :(得分:1)
使用这样的代码
public class MyService extends Service {
String msg="Toast message show";
Thread t = new Thread(){
public void run(){
Message myMessage=new Message();
Bundle resBundle = new Bundle();
resBundle.putString("status", "SUCCESS");
myMessage.obj=resBundle;
handler.sendMessage(myMessage);
}
};
}
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
Toast.makeText(getApplicationContext(), "msg", Toast.LENGTH_LONG).show();
}
}