Skip to content

Instantly share code, notes, and snippets.

@oguya
oguya / Foursquare stackTrace
Created May 20, 2014 06:48
foursquare crash stacktrace
E/AndroidRuntime( 2118): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.joelapenna.foursquared/com.joelapenna.foursquared.app.FragmentShellActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.joelapenna.foursquared.fragments.photos.o: make sure class name exists, is public, and has an empty constructor that is public
E/AndroidRuntime( 2118): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
E/AndroidRuntime( 2118): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
E/AndroidRuntime( 2118): at android.app.ActivityThread.access$600(ActivityThread.java:156)
E/AndroidRuntime( 2118): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
E/AndroidRuntime( 2118): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2118): at android.os.Looper.loop(Looper.java:153)
E/AndroidRuntime( 2118): at android.app.Ac
@oguya
oguya / edtiTextDrawable.xml
Created February 15, 2014 03:08
add drawables in editText
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="16dp"
>
<EditText
public class saveAsParcel implements Parcelable {
private String myStringValue;
public PassableObject() {}
public PassableObject(Parcel inParcel) {
myStringValue = inParcel.readString();
}
@Override
@oguya
oguya / ScreenLayoutSize.java
Created February 9, 2014 08:10
load different layouts depending on screensize
if((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE){
//load a large screen layout
}else{
//load a default screen layout
}
@oguya
oguya / fontSetter.java
Created January 30, 2014 08:51
set custom fonts in java
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);
@oguya
oguya / build.gradle
Created January 29, 2014 16:38
Spring gradle configs
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'
}
{
"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",
@oguya
oguya / RobotoFonts.java
Created January 13, 2014 12:46
Add roboto fonts in textviews android
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/Roboto-Black.ttf");
TextView tv = (TextView) findViewById(R.id.FontTextView);
tv.setTypeface(tf);
@oguya
oguya / uploaded_files.php
Created January 12, 2014 09:04
receive uploaded file...crud
<?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;
@oguya
oguya / uploadFile_java.java
Last active January 3, 2016 00:28
upload file in java to server side php
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);