Monday, 21 December 2015

Google analytics integration

https://analytics.google.com/analytics/web/?et&authuser=0#realtime/rt-app-overview/a71648538w109157415p113775085/

Tuesday, 17 March 2015

Get Installed application android

public void getAllRunningProcess() {
        int flags = PackageManager.GET_META_DATA
                | PackageManager.GET_SHARED_LIBRARY_FILES
                | PackageManager.GET_UNINSTALLED_PACKAGES;

        List<ApplicationInfo> applications = pm.getInstalledApplications(flags);
        for (ApplicationInfo appInfo : applications) {
            if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
                // System application
            } else {
                // Installed by user
                appList.add(appInfo);
                adapter = new CustomAdapter(ctx, appList);
                list_view.setAdapter(adapter);

            }
        }
    }

IT will return you list of applist which you have installed.

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);