我编写了一个函数,该函数可以扫描我的电子邮件中是否有相同主题下的未读线程,然后仅过滤这些线程下的未读消息
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".TakeTest">
<ListView
android:id="@+id/quiz_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:id="@+id/quiz_submit"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="300dp"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:onClick="onSubmitClicked"
android:text="Submit" />
</LinearLayout>
问题是,即使我知道我的邮箱中没有未读邮件,有时 messages [j] .isUnread() 有时还是正确的
谢谢
答案 0 :(得分:0)
我在想消息[j] .isUnread()返回空对象,如果您没有任何未读消息。尝试使用
if (messages[j].isUnread().length) {
return true;
}
.length属性代替。