Created
April 13, 2016 13:36
-
-
Save akari0624/ca9e9e87a851ec38d2381b89f57f44c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subscription = Observable | |
.defer(new Func0<Observable<String>>() { | |
@Override | |
public Observable<String> call() { | |
Log.d("RX",".just( ) then .defer( )"); | |
return Observable.just(withOutAsyncTask()); | |
} | |
}) | |
.map(new Func1<String, List<GRO_VO>>() { | |
@Override | |
public List<GRO_VO> call(String jsonIn) { | |
Log.d("RX", ".map"); | |
Gson gson = new Gson(); | |
Type listType = new TypeToken<List<GRO_VO>>() { | |
}.getType(); | |
return eventJoinList = gson.fromJson(jsonIn, listType); | |
} | |
}) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe(new Action1<List<GRO_VO>>() { | |
@Override | |
public void call(List<GRO_VO> gro_vos) { | |
Log.d("RX", ".subscribe"); | |
recyclerView.setAdapter(new EventJoinAdapter(gro_vos)); | |
} | |
}); | |
//////////////////////////////////////////// | |
public String withOutAsyncTask() { | |
String GroURL; | |
GroURL = theURL.URL + "GroupServlet"; | |
String mem_noMy1 = "6"; | |
// Log.d(TAG, "GroURL=" + GroURL); | |
String jsonIn = ""; | |
JsonObject jsonObject = new JsonObject(); | |
jsonObject.addProperty("action", "getEventOthersHostNotOver"); | |
jsonObject.addProperty("mem_no", mem_noMy1); | |
try { | |
jsonIn = okHttpPost(GroURL, jsonObject.toString()); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
return jsonIn; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment