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
//file download after permission check | |
private void fileDownload(String url, String fileName, String fileExtension) { | |
fileName = fileName + "." + fileExtension; | |
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension); | |
url = url.replace(" ","%20"); | |
System.out.println("URL=> "+url); | |
DownloadManager downloadManager = (DownloadManager) ((Activity) baseActivity).getSystemService(Context.DOWNLOAD_SERVICE); | |
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); | |
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE) | |
.setAllowedOverRoaming(false) |
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
// Hide the keyboard. | |
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
imm.hideSoftInputFromWindow(view.windowToken, 0) | |
// Show the keyboard. | |
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager | |
imm.showSoftInput(editText, 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
How to use vector images in android studio ? | |
1. In build.gradle (Module:app) | |
Inside the defaultConfig | |
add --> vectorDrawables.useSupportLibrary(true) | |
2.Add this field in the xml file | |
xmlns:app="http://schemas.android.com/apk/res-auto" |