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
// Instantiate the RequestQueue. | |
RequestQueue queue = Volley.newRequestQueue(this); | |
String url ="http://www.google.com"; | |
// Request a string response from the provided URL. | |
StringRequest stringRequest = new StringRequest(Request.Method.GET,url,new Response.Listener<String>() { | |
@Override | |
public void onResponse(String s) { | |
Log.d("Response:", s.toString()); | |
pDialog.hide(); | |
} |
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
new Handler().postDelayed(new Runnable() { | |
@Override | |
public void run() { | |
Intent i = new Intent(SplashActivity.this,HomeActivity.class); | |
startActivity(i); | |
finish(); | |
} | |
},1000); |
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
dependencies { | |
compile 'com.mcxiaoke.volley:library-aar:1.0.0' | |
} |
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
public class AppController extends Application { | |
public static final String TAG = AppController.class | |
.getSimpleName(); | |
private RequestQueue mRequestQueue; | |
private ImageLoader mImageLoader; | |
private static AppController mInstance; |
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
// Tag used to cancel the request | |
String tag_json_obj = "json_obj_req"; | |
String url = "http://api.androidhive.info/volley/person_object.json"; | |
final ProgressDialog pDialog = new ProgressDialog(this); | |
pDialog.setMessage("Loading..."); | |
pDialog.show(); | |
JsonObjectRequest jsonObjReq = new JsonObjectRequest(Request.Method.GET, |
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
public static class CustomAuthenticator extends Authenticator { | |
// Called when password authorization is needed | |
protected PasswordAuthentication getPasswordAuthentication() { | |
// Get information about the request | |
String prompt = getRequestingPrompt(); | |
String hostname = getRequestingHost(); | |
InetAddress ipaddr = getRequestingSite(); | |
int port = getRequestingPort(); |
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
try{ | |
JSONObject jsonObject = new JSONObject(s); | |
JSONObject propertiesObject = jsonObject.getJSONObject("properties"); | |
JSONObject idObject = propertiesObject.getJSONObject("id"); | |
String s1 = idObject.getString("type"); | |
Log.d("Type",s1); | |
} |
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
try { | |
JSONArray flimsJSON = new JSONArray(s); | |
int numVideos = flimsJSON.length(); | |
for(int i =0; i<numVideos;i++){ | |
JSONObject titleJSON = (JSONObject) flimsJSON.get(i); | |
String titleString = titleJSON.getString("title"); | |
Log.d("TITLE:",titleString); | |
} | |
Log.d("Number of MOVIES FETCHED","is"+numVideos); | |
} catch (JSONException e) { |
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
public class HelloWorld { | |
public static void main(String[] args) { | |
System.out.print("Hello World"); | |
} | |
} |
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
public class Variables { | |
public static void main(String[] args) { | |
int i=5; | |
System.out.print("The number is "); | |
System.out.print(i); | |
System.out.println("."); | |
System.out.print("It can also be written as this "+i); | |
} |
OlderNewer