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
| -------Write To File In Append Mode---------- | |
| String logDirPath = getApplicationContext().getFilesDir().getAbsolutePath() + File.separator + "Logs" | |
| + File.separator + "Log.txt"; | |
| private void writeToFile(String logFilePath, String whatToWrite) { | |
| try { | |
| if(logFilePath != null && logFilePath.trim().length() > 0) { | |
| SimpleDateFormat format = new SimpleDateFormat("EEE dd/MM/yyyy HH:mm:ss", Locale.US); | |
| String passing = format.format(new Date()) + " " + whatToWrite + "\n"; | |
| FileWriter writer = new FileWriter(logFilePath, true);//true FOR APPEND MODE | |
| writer.append(passing); |
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
| Add GooglePlayService Library To Your Project | |
| Manifest:: | |
| <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> | |
| <application ....> | |
| <meta-data | |
| android:name="com.google.android.gms.version" | |
| android:value="@integer/google_play_services_version"/> | |
| </application> |
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
| 1. Get Sender Id (And APIKeyFor ServerSide) From Google Console Project | |
| -------------------Using GCMRegistrar---------------------------------- | |
| 2. Add GCM.jar To Your Project | |
| 3. Add Required Permission Into Manifest | |
| <uses-permission android:name="android.permission.INTERNET" /> | |
| <uses-permission android:name="android.permission.WAKE_LOCK" /> | |
| <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | |
| <permission | |
| android:name="(Your_Package).permission.C2D_MESSAGE" |
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 ConversionUtils { | |
| public static int convertHexToDecimal(String hexCode) { | |
| return Integer.parseInt(hexCode, 16); | |
| } | |
| public static String convertDecimalToHex(int decCode) { | |
| return Integer.toHexString(decCode); | |
| } |
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 List<Employee> firstArrayList; | |
| private List<Employee> getFirstArrayList() { | |
| List<Employee> arrayList = new ArrayList<Employee>(); | |
| arrayList.add(new Employee(1, "Donut")); | |
| arrayList.add(new Employee(2, "Froyo")); | |
| arrayList.add(new Employee(3, "Eclair")); | |
| arrayList.add(new Employee(4, "Gingerbread")); | |
| arrayList.add(new Employee(5, "HoneyComb")); | |
| arrayList.add(new Employee(6, "IceCream Sandwich")); | |
| arrayList.add(new Employee(7, "Jelly Bean")); |
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
| viewHolder.radioGroup.setOnCheckedChangeListener(null); //Most Important Thing To Write O/W Won't Work | |
| if(radioModel.getCheckedId() == 0) { | |
| viewHolder.radioGroup.check(R.id.radioOne); | |
| } else if(radioModel.getCheckedId() == 1) { | |
| viewHolder.radioGroup.check(R.id.radioTwo); | |
| } else if(radioModel.getCheckedId() == 2) { | |
| viewHolder.radioGroup.check(R.id.radioThree); | |
| } | |
| viewHolder.radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { | |
| @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
| @Override | |
| protected void onStart() { | |
| super.onStart(); | |
| boolean isRunning = isServiceRunning(BackgroundService.class); | |
| if(isRunning) { | |
| Intent serviceIntent = new Intent(this, BackgroundService.class); | |
| stopService(serviceIntent); | |
| } | |
| } |
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
| @Override | |
| public boolean onKeyDown(int keyCode, KeyEvent keyEvent) { | |
| if ((CompatibilityUtil.getSdkVersion() < | |
| android.os.Build.VERSION_CODES.ECLAIR) | |
| && keyCode == KeyEvent.KEYCODE_BACK | |
| && keyEvent.getRepeatCount() == 0) { | |
| onBackPressed(); | |
| } | |
| return super.onKeyDown(keyCode, keyEvent); |
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
| <style name="PauseDialog" parent="@android:style/Theme.Dialog"> | |
| <item name="android:windowAnimationStyle">@style/PauseDialogAnimation</item> | |
| </style> | |
| <style name="PauseDialogAnimation"> | |
| <item name="android:windowEnterAnimation">@anim/bounce_scale</item> | |
| <item name="android:windowExitAnimation">@anim/bounce_minimize</item> | |
| </style> | |
| <style name="DialogActivity" parent="android:Theme.Dialog"> | |
| <item name="android:windowFrame">@null</item> | |
| <item name="android:windowIsFloating">true</item> |
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
| package moc.nahba.diord.utils; | |
| public class Key { | |
| private final int x;//Row | |
| private final int y;//Column | |
| public Key(int x, int y) { | |
| this.x = x; | |
| this.y = y; | |
| } |