安卓错误: "Not a Statement" in a specific block of code

标签 android

我收到此代码块的错误(不是语句): 如果有人有问题,请提出一些解决方案

else{
 Toast.makeText(getApplicationContext(), "Swipe down to update the list", Toast.LENGTH_LONG).show;
 swipeRefreshLayout.post(new Runnable()
 {
    @Override
    public void run(){
      swipeRefreshLayout.setRefreshing(true);
      fetchMovies();
    }
 }
 );
}

最佳答案

Toast.show 是一个方法,而不是一个属性。它应该被称为 show() 并在末尾加上括号:

Toast.makeText(getApplicationContext(), "Swipe down to update the list", Toast.LENGTH_LONG).show();

关于安卓错误: "Not a Statement" in a specific block of code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59810896/

相关文章:

android - 无法在相机应用程序中导入 android.os.SystemProperties

java - Android Studio 选项卡式 Activity

android - 在上一个 Activity 中调用 startService 时 bindService 失败

Eclipse 中的 Android SDK 给出关于过期证书的错误

Android - 从另一个 Activity 将对象添加到 ListView

java - 四个 Activity 不显示 Toast

java - RxJava 使用 foreach 循环改造请求链

android - 如何在ListView中开发ListView?

java - 在RestoreInstanceState上获取所有View对象

android - 从android中的文件读取