有没有办法使用Room数据库RxJava3?
当我尝试返回Observable或Single从 Room返回时Query它显示以下错误的问题:
error: Not sure how to convert a Cursor to this method's return type
public abstract io.reactivex.rxjava3.core.Single<java.util.List<com.osama.movieshow.data.movie.Movie>> getAllFavorites();
我的房间查询:
@Query("select * from favorites")
fun getAllFavorites():Single<List<Movie>>
我Single从import io.reactivex.rxjava3.core.Single
我有用于发送通知的应用,我将这段代码用于待处理的意图
Intent myIntent = new Intent(getApplicationContext(),MainActivity.class);
myIntent.putExtra("link",Link);
PendingIntent intent2 =
PendingIntent.getActivity(getApplicationContext(),1,myIntent,
PendingIntent.FLAG_ONE_SHOT);
Run Code Online (Sandbox Code Playgroud)
并第一次很好地工作,但是我在每1分钟调用一次的方法中使用了这段代码。
问题在于link变量从一个变为另一个。
当我在中MainActivity找到数据时,仅找到最后一个链接,所有创建的通知都具有最后一个链接。
而且我不知道如何避免这种情况。