This file contains hidden or 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
| Let's take a look at the most common implicit intents such as making a phone call, launching a web address, sending an email, etc. | |
| Phone Call | |
| Permissions: | |
| <uses-permission android:name="android.permission.CALL_PHONE" /> | |
| Intent: | |
| Intent callIntent = new Intent(Intent.ACTION_CALL); |
This file contains hidden or 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
| apply plugin: 'com.android.application' | |
| def versionMajor = 2 | |
| def versionMinor = 0 | |
| def versionPatch = 6 | |
| def versionBuild = 0 // bump for dogfood builds, public betas, etc. | |
| android { | |
| compileSdkVersion 19 | |
| buildToolsVersion '19.1.0' |
This file contains hidden or 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 void GenericAsyncTask<T> extends AsyncTask<Void, Void , T>{ | |
| public interface TaskCompletionDelegate<T>{ | |
| public void onTaskCompleted(T result)} | |
| private Class<T> type; | |
| private TaskCompletionDelegate<T> listener; | |
| public GenericAsyncTask(Class<T> classType , TaskCompletionDelegate listener ){ | |
| this.type = classType; | |
| this.listener = listener; | |
| } |
This file contains hidden or 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
| private int getItemViewType(Cursor cursor) { | |
| String type = cursor.getString(cursor.getColumnIndex("type")); | |
| if (type.equals("1")) { | |
| return 0; | |
| } else { | |
| return 1; | |
| } | |
| } | |
| @Override |
This file contains hidden or 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
| import java.util.Map.Entry; | |
| import java.util.TreeMap; | |
| // See http://stackoverflow.com/a/13400317/611182 | |
| public class Main { | |
| private static TreeMap<Double, String> m = new TreeMap<Double, String>(); | |
| static { | |
| m.put(1.0, "A"); | |
| m.put(2.9, null); |
This file contains hidden or 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
| For setting up adb and other platform tools at path. | |
| echo 'export PATH=$PATH:'$HOME'/Library/Android/sdk/platform-tools' >> ~/.bash_profile |
This file contains hidden or 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
| To create a symlink : | |
| sudo ln -s ${PWD}/bin/devesh /usr/bin/devesh |
This file contains hidden or 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
| /etc/profile | |
| ~/.bash_profile | |
| ~/.bash_login | |
| ~/.profile |
This file contains hidden or 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 MyClass{ | |
| private volatile MyClass myClassObject; | |
| public MyClass getInstance(){ | |
| MyClass helper = myClassObject; | |
| // Optimisation for getting instance, if the helper has already been initialised return that. | |
| if(helper == null){ | |
| synchronised(MyClass.this){ | |
| // Since synchronised block takes some time to initialise ,in the mean time another thread might have entered | |
| // the synchronised block and initialised the helper variable. By ensuring that the myclassObject is volatile, we have established | |
| // a happens-before functionality on the myClassObject. |
This file contains hidden or 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
| /* | |
| * Copyright (C) 2013 Square, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
OlderNewer