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
// Way 1 | |
public void onError(Throwable e){ | |
Gson gson = new Gson(); | |
TypeAdapter<YourResponseModel> adapter = gson.getAdapter(YourResponseModel.class); | |
try { | |
if (response.errorBody() != null) | |
registerResponse = | |
adapter.fromJson( |
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 String getLauncherActivity(){ | |
String activityName = ""; | |
final PackageManager pm = getPackageManager(); | |
Intent intent = pm.getLaunchIntentForPackage(getPackageName()); | |
List<ResolveInfo> activityList = pm.queryIntentActivities(intent,0); | |
if(activityList != null){ | |
activityName = activityList.get(0).activityInfo.name; | |
} | |
return activityName; |
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 AlertServices{ | |
private static Toast toast; | |
public static void showToast(Context context, String message) { | |
try { | |
if (!toast.getView().isShown()) { | |
toast = Toast.makeText(context, message, Toast.LENGTH_SHORT); | |
toast.show(); |
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
<?php | |
require_once('connection.php'); | |
$title=$_POST['title']; | |
$mes=$_POST['details']; | |
$loc=$_POST['loc']; | |
$blood=$_POST['blood']; | |
//$uiId='gkveBvqzHoVXmAAXKU4rSbaAltu2'; | |
function send ($tokens, $msg) |
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 boolean isMyServiceRunning(Class<?> serviceClass) { | |
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); | |
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | |
if (serviceClass.getName().equals(service.service.getClassName())) { | |
return true; | |
} | |
} | |
return false; | |
} |
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
# This is a configuration file for ProGuard. | |
-dontusemixedcaseclassnames | |
-dontskipnonpubliclibraryclasses | |
-verbose | |
-dontpreverify | |
# Enable Optimization. # Optimization is turned off by default. | |
-optimizations code/simplification/arithmetic,!code/simplification/cast,!field |
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 MainActivity extends AppCompatActivity implements View.OnClickListener { | |
private PermissionManager permissionManager; | |
private Button openCameraButton; | |
private ImageView imageView; | |
private final int REQUEST_CAMERA = 13; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
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 boolean hasPermission(String permission) { | |
return ContextCompat.checkSelfPermission(getApplicationContext(), permission) == PackageManager.PERMISSION_GRANTED; | |
} | |
public void askForMultiplePermissions(){ | |
final int REQUEST_CODE = 13; | |
String cameraPermissin = Manifest.permission.CAMERA; | |
String readContactsPermission = Manifest.permission.READ_CONTACTS; | |
String readExternalStoragePermission = Manifest.permission.READ_EXTERNAL_STORAGE; |
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 void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
switch (requestCode) { | |
case REQUEST_CAMERA: { | |
// If request is cancelled, the result arrays are empty. | |
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { | |
//Permission was granted. Now you can call your method to open camera, fetch contact or whatever | |
openCamera(); |
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 String getInBangla(String string){ | |
Character bangla_number[]={'১','২','৩','৪','৫','৬','৭','৮','৯','০'}; | |
Character eng_number[]={'1','2','3','4','5','6','7','8','9','0'}; | |
String values = ""; | |
char[] character = string.toCharArray(); | |
for (int i=0; i<character.length ; i++) { | |
Character c = ' '; | |
for (int j = 0; j < eng_number.length; j++) { |