Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. if (isNetworkAvailable()) {
  2.  
  3. AppFunction appFunction = new AppFunction(getApplicationContext(), this);
  4. AQuery mQuery = new AQuery(this);
  5. appFunction.Progress_Dialog("Loading...");
  6.  
  7. mQuery.progress(AppFunction.mProgressDialog).ajax("http://www.rattil.org/MobileApp/JSON-APIS_v_2.0/TimeLine.php?UserID=9&LangId=1&StartDate=2013-08-21&EndDate=2013-09-20", JSONArray.class, new AjaxCallback<JSONArray>() {
  8.  
  9. @Override
  10. public void callback(String url, JSONArray json, AjaxStatus status) {
  11.  
  12. if (json != null) {
  13. for (int i = 0; i < json.length(); i++) {
  14. try {
  15. Log.e("Event text", json.getJSONObject(i).getString("EventText"));
  16.  
  17. LayoutParams lparams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  18. TextView tv = new TextView(LoginActivity.this);
  19. tv.setLayoutParams(lparams);
  20. tv.setText(Html.fromHtml(json.getJSONObject(i).getString("EventText")));
  21. rl.addView(tv);
  22. } catch (JSONException e) {
  23. e.printStackTrace();
  24. }
  25. }
  26. } else {
  27. Toast.makeText(getApplicationContext(), "Error in connection...", Toast.LENGTH_LONG).show();
  28. }
  29. }
  30. });
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement