- Java
- Clojure
Download source file
To start REPL
java -cp clojure-1.7.0.jar clojure.main
public class SomeActivity extends Activity { | |
// make it a field so we can dismiss it when the activity pauses. | |
// otherwise the window will leak and cause and exception when the activity no longer exists | |
private PopupWindow mPopup; | |
public void showPopup() { | |
View popupView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.indeterminate_progress, null); | |
Display display = getWindowManager().getDefaultDisplay(); | |
// getWidth() and getHeight() are deprecated and we should use getSize() but it's available on API level 13 and up | |
mPopup = new PopupWindow(popupView, display.getWidth(), display.getHeight()); |
import android.support.v4.app.DialogFragment; | |
import android.support.v4.app.FragmentActivity; | |
// omitted irrelevant imports | |
public class MainActivity extends FragmentActivity { | |
private static final String TAG = "ConfirmDialogSample.MainActivity"; | |
private static final int DELETE_DIALOG = 0; | |
@Override |
@Override | |
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, | |
String[] requiredFeatures, Bundle options) throws NetworkErrorException { | |
Bundle reply = new Bundle(); | |
Account account = new Account("LunchBuddy", "com.blogspot.fwfaill.lunchbuddy.account"); | |
AccountManager am = AccountManager.get(mContext); | |
boolean accountCreated = am.addAccountExplicitly(account, null, null); | |
if (accountCreated) { | |
reply.putString(AccountManager.KEY_ACCOUNT_NAME, "LunchBuddy"); | |
reply.putString(AccountManager.KEY_ACCOUNT_TYPE, "com.blogspot.fwfaill.lunchbuddy.account"); |
Uri uri = new Uri("https://soludigital1.sharepoint.com/sites/dev-aleksi/_api/web/getavailablewebtemplates(lcid=1033)"); | |
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); | |
request.Method = "GET"; | |
request.Accept = "application/json;odata=verbose"; | |
request.Headers.Add("Authorization", "Bearer " + accessToken.AccessToken); | |
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | |
using (var reader = new StreamReader(response.GetResponseStream())) | |
{ | |
return reader.ReadToEnd(); |