26 Oct 2015

Seeing Unsupported major.minor version 52.0 on some plugins

Some Android Studio plugins do not support Java 1.6 anymore, so it's best to confirm what version you are using. Inside Android Studio, click on About Android Studio. You should see the JRE version listed as 1.x.x below :
Amar's Android Tech
If you have multiple Java versions installed, you should make sure that v1.6 is not being used.
On OS X machines, you can remove the JDK from being noticed. You can move it the temporary directory in case other issues are created by this change.
sudo mv /System/Library/Java/JavaVirtualMachines/1.6.0.jdk /tmp
Read More !

17 Oct 2015

Unable to delete emulator getting "AVD is currently running in the Emulator"

Open the Tools => Android => AVD Manager and select virtual device that you want to delete. Click on the down arrow at the end and select the [Show on Disk] option which will open the emulator directory. Inside the [Your Device].avd folder, locate any *.lock files and delete them. You can now delete the emulator.
Read More !

10 Oct 2015

Android Studio is Crashing or Freezing Up

If Android Studio starts freezing up or crashing even after rebooting the IDE or your computer, your Studio has likely become corrupted. The best way to resolve this is to clear all the caches by removing all the following folders:

~/Library/Application Support/AndroidStudio
~/Library/Caches/AndroidStudio
~/Library/Logs/AndroidStudio
~/Library/Preferences/AndroidStudio

and then uninstall Android Studio and re-install the latest stable version. This should allow you to boot Android Studio again without errors.
Read More !

5 Oct 2015

Add application shortcut to the home screen

In this post, I will be discussing about how to create shortcut for Android applications programmatically.
What is Android Shortcut?
Android allows you to create app shortcuts, but you can also create special shortcuts that link directly to screens within an app. For example, shortcuts could link to the Navigation screen in Maps or any screen in the Settings app.
To Create Shortcut
It is very simple to create shortcut programmatically, all you need to do is broadcast the intent with necessary information.
Below code snippet will create the shortcut.
//create shortcuts of app
        Intent HomeScreenShortCut= new Intent(getApplicationContext(),
                MainActivity.class);
        HomeScreenShortCut.setAction(Intent.ACTION_MAIN);
        HomeScreenShortCut.putExtra("duplicate", false);
        //shortcutIntent is added with addIntent
        Intent addIntent = new Intent();
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, HomeScreenShortCut);
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Matrialtest");
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                Intent.ShortcutIconResource.fromContext(getApplicationContext(),
                               R.drawable.ic_launcher));
        addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
        getApplicationContext().sendBroadcast(addIntent);

Add add this permission to your manifest

<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
That’s all. It’s time to test our code.
Run the application using emulator or device by right clicking on the project >> Run as >> Android application >> Choose emulator or device.
Read More !