This file contains 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 static android.Manifest.permission.CAMERA; | |
public class Camera extends AppCompatActivity { | |
private static final int PERMISSION_REQUEST_CODE = 101; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_camera_permission); |
This file contains 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
//open settings when user | |
private void openSettings() { | |
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |
Uri uri = Uri.fromParts("package", getPackageName(), null); | |
intent.setData(uri); | |
startActivity(intent); | |
} |
This file contains 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 this line in import section | |
import static android.Manifest.permission.CAMERA; | |
private void requestPermission() { | |
ActivityCompat.requestPermissions(this, new String[]{CAMERA}, PERMISSION_REQUEST_CODE); | |
} | |
private boolean checkPermission() { | |
return ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA) == PackageManager.PERMISSION_GRANTED; | |
} |
This file contains 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 void showAlertDialog(String title, String message, String positiveButtonText, String negativeButtonText, DialogInterface.OnClickListener positiveListener, DialogInterface.OnClickListener negativeListener) { | |
AlertDialog dialog = new AlertDialog.Builder(CameraPermission.this) | |
.setPositiveButton(positiveButtonText, positiveListener) | |
.setNegativeButton(negativeButtonText, negativeListener) | |
.create(); | |
if (title != null || !title.isEmpty()) { | |
dialog.setTitle(title); | |
} | |
dialog.setMessage(message); | |
dialog.show(); |
This file contains 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 get string value from shared preference | |
String phoneNumber = SharedPrefHandler.getInstance(MainActivity.this, SharedPrefHandler.PrefFiles.USER_DE | |
.getValue(SharedPrefHandler.Keys.USER_DETAILS); | |
//To get boolean value from shared preference | |
boolean userKyc = SharedPrefHandler.getInstance(MainActivity.this, SharedPrefHandler.PrefFiles.USER_DETAI | |
.getBooleanValue(SharedPrefHandler.Keys.USER_KYC); | |
//To add string value from shared preference | |
SharedPrefHandler.getInstance(MainActivity.this, SharedPrefHandler.PrefFiles.USER_DETAILS_PREF) |
This file contains 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 allow advanced options to be changed. | |
EXEC sp_configure 'show advanced options', 1; | |
GO | |
-- To update the currently configured value for advanced options. | |
RECONFIGURE; | |
GO | |
-- To enable the feature. | |
EXEC sp_configure 'xp_cmdshell', 1; | |
GO | |
-- To update the currently configured value for this feature. |
This file contains 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
CREATE PROCEDURE [dbo].[auto_backup] as | |
declare | |
@DATABASENAME nvarchar (100), | |
@PATH nvarchar (100), | |
@zipname nvarchar (100), | |
@zipname1 nvarchar (100) | |
SET @DATABASENAME = db_name() | |
SET @PATH = 'C:\DB_Backup\'+@DATABASENAME | |
DBCC SHRINKDATABASE (@DATABASENAME) | |
BACKUP DATABASE @DATABASENAME TO DISK =@PATH WITH NAME = 'BACKUP',STATS = 10 |
This file contains 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
implementation 'com.squareup.picasso:picasso:2.71828' | |
implementation 'com.android.support:cardview-v7:26.1.0' | |
implementation 'com.android.support:recyclerview-v7:26.1.0' |
This file contains 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 HomeActivity extends AppCompatActivity { | |
private RecyclerView rvSubject; | |
private SubjectAdapter subjectAdapter; | |
private ArrayList<Subject> subjects; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
NewerOlder