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 abstract class LoginableActivity extends Activity { | |
private static final int LOGIN = 42; | |
public static boolean loggedIn = false; | |
public void login(View target) { | |
startActivityForResult(new Intent(this, LoginActivity.class), LOGIN); | |
} | |
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
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 DefaultHttpClient().execute(new HttpGet("http://www.example.com/somefile.ext")) | |
.getEntity().writeTo( | |
new FileOutputStream(new File(root,"Video.mp4"))); |
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 TweetsRequest extends JsonObjectRequest { | |
public TweetsRequest(String url, Listener<JSONObject> listener, | |
ErrorListener errorListener, List<NameValuePair> params) { | |
super(url + "?" + URLEncodedUtils.format(params, "UTF-8"), | |
null, listener, errorListener); | |
} | |
@Override | |
public Map<String, String> getHeaders() throws AuthFailureError { |
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
final class TokenRequest extends StringRequest { | |
TokenRequest(int method, String url, Listener<String> listener, | |
ErrorListener errorListener) { | |
super(method, url, listener, errorListener); | |
} | |
@Override | |
protected Map<String, String> getParams() throws AuthFailureError { | |
Map<String, String> params = new HashMap<String, String>(); | |
params.put("grant_type", "client_credentials"); |
NewerOlder