Wednesday, 8 October 2014

Interface in main Activity

http://stackoverflow.com/questions/12575068/how-to-get-the-result-of-onpostexecute-to-main-activity-because-asynctask-is-a

Friday, 26 September 2014

Twiiter integration

Nice tutorial url

http://blogs.shephertz.com/2014/05/15/how-to-integrate-twitter-in-your-android-app/

Sunday, 21 September 2014

Animation code for shaking

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="100"
    android:fromDegrees="-5"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:repeatMode="reverse"
    android:toDegrees="5" />

Wednesday, 27 August 2014

http://stackoverflow.com/questions/2711858/is-it-possible-to-set-font-for-entire-application

public final class FontsOverride {

    public static void setDefaultFont(Context context,
            String staticTypefaceFieldName, String fontAssetName) {
        final Typeface regular = Typeface.createFromAsset(context.getAssets(),
                fontAssetName);
        replaceFont(staticTypefaceFieldName, regular);
    }

    protected static void replaceFont(String staticTypefaceFieldName,
            final Typeface newTypeface) {
        try {
            final Field staticField = Typeface.class
                    .getDeclaredField(staticTypefaceFieldName);
            staticField.setAccessible(true);
            staticField.set(null, newTypeface);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

On splash screen call
FontsOverride.setDefaultFont(this, "DEFAULT", "MyFontAsset.ttf");
FontsOverride.setDefaultFont(this, "MONOSPACE", "MyFontAsset2.ttf");
And set in style.xml
 <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:typeface">monospace</item>
    </style>

Thanks


Friday, 25 July 2014

Clear stack of all activities

Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
ComponentName cn = intent.getComponent();
Intent mainIntent = IntentCompat.makeRestartActivityTask(cn);
startActivity(mainIntent);

Monday, 24 March 2014

Change color of text in MediaController in Android

MediaController mediaController = new MediaController(this);
you can use: MediaController mediaController = new MediaController(new ContextThemeWrapper(this,R.style.CustomTheme));

<resources>
    <style name="Theme.MusicPlayer">
        <item name="android:textColor">#FFFFFF</item>
    </style>
</resources>

Thursday, 6 March 2014

In purchase demo

http://www.techotopia.com/index.php/Integrating_Google_Play_In-app_Billing_into_an_Android_Application_%E2%80%93_A_Tutorial

Wednesday, 5 March 2014

LinearLayout background fluctuate in scrollview with edittext

This is happen because i have given background  color to edittext when i remove background color replace with background image then its works fine for me.

Tuesday, 4 February 2014

Show Thread policy error

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy); 

Friday, 24 January 2014

Get files in assets folder

Where image is folder name for images
String file[] = am.list("image");
for(int i=0;i<file.length;i++)
{
System.out.println("Files "+file[i].toString());
}

Thursday, 23 January 2014