1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Observable.just(filename) .map(new Func<String, String>() { @Override public String call(String s) { File file; try { file = File.createTempFile(filename, null, getCacheDir()); storedCacheName = file.getName(); } catch(IOException e) { e.printStackTrace(); } return storedCacheName; } }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscrbe(new Observer<String>() { @Override public void onNext(String s) { mResulteText.setText(s); }
@Override public void onError(Throwable e) { Lod.e(TAG, e.getMessage()); }
@Override public void onCompleted() { } });
|