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
from django.contrib.auth.models import User | |
User.objects.get(username=the_username).pk |
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
//ImageLoader lib => http://search.maven.org/remotecontent?filepath=com/novoda/imageloader/imageloader-core/1.5.8/imageloader-core-1.5.8.jar | |
String image_url = "http://mycodeandlife.files.wordpress.com/2013/01/384088_2317070728022_2086719259_n.jpg"; | |
ImageView image = (ImageView) findViewById(R.id.imageView1); | |
// Get singletone instance of ImageLoader | |
ImageLoader imageLoader = ImageLoader.getInstance(); | |
// Initialize ImageLoader with configuration. Do it once. | |
imageLoader.init(ImageLoaderConfiguration.createDefault(this)); | |
// Load and display image asynchronously | |
DisplayImageOptions options = new DisplayImageOptions.Builder() |
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 void uploadFile(String filePath, String serverURL) throws IOException { | |
HttpClient httpClient = new DefaultHttpClient(); | |
//post request to send file | |
HttpPost httpPost = new HttpPost(serverURL); | |
// StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); | |
// StrictMode.setThreadPolicy(policy); | |
FileBody uploadFile = new FileBody(new File(filePath)); | |
MultipartEntity reqEntity = new MultipartEntity(); | |
// reqEntity.addPart("the args. the server takes", uploadFile); |
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
<?php | |
$storage = $_SERVER['DOCUMENT_ROOT'].'/droid/uploads/'; | |
#check uploaded file status | |
if(is_uploaded_file($_FILES['uploaded_file']['tmp_name'])){ | |
echo "\nfile successfully uploaded!\n"; | |
}else{ | |
echo "\nfile not uploaded!\n"; | |
exit; |
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
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/Roboto-Black.ttf"); | |
TextView tv = (TextView) findViewById(R.id.FontTextView); | |
tv.setTypeface(tf); |
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
{ | |
"ANDROID_VERSION": 1.5, | |
"APP_VERSION_CODE": 8, | |
"APP_VERSION_NAME": 1.3, | |
"AVAILABLE_MEM_SIZE": 181972992, | |
"BRAND": "generic", | |
"BUILD": { | |
"BOARD": "unknown", | |
"BRAND": "generic", | |
"DEVICE": "generic", |
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 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE' | |
compile 'org.springframework.android:spring-android-auth:1.0.1.RELEASE' | |
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE' | |
} |
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 MyApplication extends Application { | |
private Typeface normalFont; | |
private Typeface boldFont; | |
//FontSetter fontSetter = (FontSetter) getApplication(); | |
//TextView myTextView = (TextView) findViewById(R.id.my_textview); | |
//application.setTypeface(myTextView); | |
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
if((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE){ | |
//load a large screen layout | |
}else{ | |
//load a default screen layout | |
} |
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 saveAsParcel implements Parcelable { | |
private String myStringValue; | |
public PassableObject() {} | |
public PassableObject(Parcel inParcel) { | |
myStringValue = inParcel.readString(); | |
} | |
@Override |
OlderNewer