This file contains hidden or 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
//flip1.setInAnimation(AnimationHelper | |
// .inFromRightAnimation(300)); | |
// flip1.setOutAnimation(AnimationHelper | |
// .outToLeftAnimation(300)); | |
package com.euphratesmedia.commonroutines; | |
import android.view.animation.AccelerateInterpolator; | |
import android.view.animation.Animation; | |
import android.view.animation.TranslateAnimation; |
This file contains hidden or 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
private ProgressDialog myProgressDialog; | |
... | |
myProgressDialog = ProgressDialog.show(actRSS.this, | |
"Please wait...", "Loading Data...", true); | |
... | |
myProgressDialog.dismiss(); |
This file contains hidden or 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
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
// Add code here to do background processing | |
// | |
// | |
dispatch_async( dispatch_get_main_queue(), ^{ | |
// Add code here to update the UI/send notifications based on the | |
// results of the background processing | |
}); | |
}); |
This file contains hidden or 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
#define isPhone568 ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568) | |
#define iPhone568ImageNamed(image) (isPhone568 ? [NSString stringWithFormat:@"%@-568h.%@", [image stringByDeletingPathExtension], [image pathExtension]] : image) | |
#define iPhone568Image(image) ([UIImage imageNamed:iPhone568ImageNamed(image)]) |
This file contains hidden or 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
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"title" | |
message:@"prompt" | |
delegate:self | |
cancelButtonTitle:@"Cancel" | |
otherButtonTitles:@"Ok", nil ]; | |
alert.tag = 10; | |
[alert show]; |
This file contains hidden or 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
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) | |
my_task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[])null); | |
else | |
my_task.execute((Void[])null); |
This file contains hidden or 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
private void checkGooglePlayServicesIsAvailable() { | |
int errorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); | |
if (errorCode != ConnectionResult.SUCCESS) { | |
GooglePlayServicesUtil.getErrorDialog(errorCode, this, 0).show(); | |
} | |
} |
This file contains hidden or 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 Item[] items = { | |
new Item("Email", android.R.drawable.ic_menu_add), | |
new Item("Facebook", android.R.drawable.ic_menu_delete), | |
new Item("...", 0),//no icon for this one | |
}; | |
ListAdapter adapter = new ArrayAdapter<Item>( | |
this, | |
android.R.layout.select_dialog_item, | |
android.R.id.text1, |
This file contains hidden or 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
// copied from : | |
// http://stackoverflow.com/a/17492949/305135 | |
public static class UacHelper | |
{ | |
private const string uacRegistryKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"; | |
private const string uacRegistryValue = "EnableLUA"; | |
private static uint STANDARD_RIGHTS_READ = 0x00020000; | |
private static uint TOKEN_QUERY = 0x0008; |
This file contains hidden or 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 JSONObject convertKeyValueToJSON(LinkedTreeMap<String, Object> ltm) { | |
JSONObject jo=new JSONObject(); | |
Object[] objs = ltm.entrySet().toArray(); | |
for (int l=0;l<objs.length;l++) | |
{ | |
Map.Entry o= (Map.Entry) objs[l]; | |
try { | |
if (o.getValue() instanceof LinkedTreeMap) | |
jo.put(o.getKey().toString(),convertKeyValueToJSON((LinkedTreeMap<String, Object>) o.getValue())); | |
else |