我已经开始研究retrolambda 和rxjava。我自己转换了一些表达式,但其中一些我无法转换。我已将 retrolambda 添加到我的项目中。这里是示例
public Observable<ImmutableList<Repository>> getUsersRepositories() {
return githubApiService.getUsersRepositories(user.login)
.map(repositoryResponses -> {
final ImmutableList.Builder<Repository> listBuilder = ImmutableList.builder();
for (RepositoryResponse repositoryResponse : repositoryResponses) {
Repository repository = new Repository();
repository.id = repositoryResponse.id;
repository.name = repositoryResponse.name;
repository.url = repositoryResponse.url;
listBuilder.add(repository);
}
return listBuilder.build();
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
Run Code Online (Sandbox Code Playgroud)
但我不知道如何转换这种代码的和平:
obs.subscribe(new Observer<List<Integer>>() {
public void onCompleted() {
System.out.println("completed");
}
public void onError(Throwable e) {
System.out.println("failure");
}
public void onNext(List<Integer> value) {
System.out.println("onnext=" + value);
}
});
Run Code Online (Sandbox Code Playgroud) 我需要从中心画出局部图像
我知道批量的draw()方法有很多参数,但没有关于所有这些参数的好文档,所以我无法弄清楚如何使用它.
这是我实施的:
public class TexturePart {
Texture tex;
Vector2 position;
// Target Dimension of image
int targetWidth;
int targetHeight;
// Src Dimensions of Image
int srcWidth;
int srcHeight;
int srcX;
int srcY;
// Ratio of dimension of target and source
float srcTargetRatioX;
float srcTargetRatioY;
// ImagePart variables with values between 0-100 to draw part of image
int startPercentX;
int endPercentX;
int startPercentY;
int endPercentY;
int clipWidth;
int clipHeight;
int clipSrcWidth;
int clipSrcHeight;
public TexturePart(TextureRegion reg, float x, float …Run Code Online (Sandbox Code Playgroud) 无法在libgdx android上播放声音.
Sound sound = Gdx.audio.newSound(Gdx.files.internal("sound.wav"));
sound.play();
Run Code Online (Sandbox Code Playgroud)
我把"sound.wav"放到了资源文件夹中.
我正在播放在线流媒体播放的媒体播放器:
mMediaPlayer = new MediaPlayer();
try {
mMediaPlayer.setDataSource("http://online-radioroks.tavrmedia.ua/RadioROKS");
mMediaPlayer.prepareAsync();
mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
start();
}
});
notifyCallbackListeners(PlayerCallbackEvent.PLAYER_SONG_CHANGE);
}
catch (IllegalArgumentException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
} catch (IllegalStateException ex){
ex.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
它运行正常,但是我可以从流中获取数据,就像现在播放的歌曲和收音机的名称一样吗?