GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #62 from ObjectiveTruth/master · linuxgg/RxJava-Android-Samples@fb5cb28

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • app/src/main/java/com/morihacky/android/rxjava/volley
    • VolleyDemoFragment.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎app/src/main/java/com/morihacky/android/rxjava/volley/VolleyDemoFragment.java‎

Copy file name to clipboardExpand all lines: app/src/main/java/com/morihacky/android/rxjava/volley/VolleyDemoFragment.java
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public void onDestroyView() {
7474
ButterKnife.unbind(this);
7575
}
7676

77+
/**
78+
* Creates and returns an observable generated from the Future returned from
79+
* {@code getRouteData()}. The observable can then be subscribed to as shown in
80+
* {@code startVolleyRequest()}
81+
* @return Observable<JSONObject>
82+
*/
7783
public Observable<JSONObject> newGetRouteData() {
7884
return Observable.defer(() -> {
7985
try {
@@ -119,11 +125,16 @@ public void onNext(JSONObject jsonObject) {
119125
}
120126
}));
121127
}
122-
128+
/**
129+
* Converts the Asynchronous Request into a Synchronous Future that can be used to
130+
* block via {@code Future.get()}. Observables require blocking/synchronous functions
131+
* @return JSONObject
132+
* @throws ExecutionException
133+
* @throws InterruptedException
134+
*/
123135
private JSONObject getRouteData() throws ExecutionException, InterruptedException {
124136
RequestFuture<JSONObject> future = RequestFuture.newFuture();
125137
String url = "http://www.weather.com.cn/adat/sk/101010100.html";
126-
final Request.Priority priority = Request.Priority.IMMEDIATE;
127138
JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET, url, future, future);
128139
MyVolley.getRequestQueue().add(req);
129140
return future.get();

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.