CopyPastor

Detecting plagiarism made easy.

Score: 1.8593269819238438; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2014-09-06
by Shivaraj Patil

Original Post

Original - Posted on 2014-09-05
by Shivaraj Patil



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Yes. Different manufacturer use different SDcard name like in Samsung Tab 3 its extsd, and other samsung devices use sdcard like this different manufacturer use different names.
I had the same requirement as you. so i have created a sample example for you from my project goto this link [Android Directory chooser][1] example which uses the androi-dirchooser library. This example detect the SDcard and list all the subfolders and it also detects if the device has morethan one SDcard.
Part of the code looks like this For full example goto the link [Android Directory Chooser][2] /** * Returns the path to internal storage ex:- /storage/emulated/0 * * @return */ private String getInternalDirectoryPath() { return Environment.getExternalStorageDirectory().getAbsolutePath(); }
/** * Returns the SDcard storage path for samsung ex:- /storage/extSdCard * * @return */ private String getSDcardDirectoryPath() { return System.getenv("SECONDARY_STORAGE"); }

mSdcardLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String sdCardPath; /*** * Null check because user may click on already selected buton before selecting the folder * And mSelectedDir may contain some wrong path like when user confirm dialog and swith back again */
if (mSelectedDir != null && !mSelectedDir.getAbsolutePath().contains(System.getenv("SECONDARY_STORAGE"))) { mCurrentInternalPath = mSelectedDir.getAbsolutePath(); } else { mCurrentInternalPath = getInternalDirectoryPath(); } if (mCurrentSDcardPath != null) { sdCardPath = mCurrentSDcardPath; } else { sdCardPath = getSDcardDirectoryPath(); } //When there is only one SDcard if (sdCardPath != null) { if (!sdCardPath.contains(":")) { updateButtonColor(STORAGE_EXTERNAL); File dir = new File(sdCardPath); changeDirectory(dir); } else if (sdCardPath.contains(":")) { //Multiple Sdcards show root folder and remove the Internal storage from that. updateButtonColor(STORAGE_EXTERNAL); File dir = new File("/storage"); changeDirectory(dir); } } else { //In some unknown scenario at least we can list the root folder updateButtonColor(STORAGE_EXTERNAL); File dir = new File("/storage"); changeDirectory(dir); }

} });

[1]: https://github.com/shivarajp/AndroidDirectoryChooserExample [2]: https://github.com/shivarajp/AndroidDirectoryChooserExample
Yes. Different manufacturer use different SDcard name like in Samsung Tab 3 its extsd, and other samsung devices use sdcard like this different manufacturer use different names.
I had the same requirement as you. so i have created a sample example for you from my project goto this link [Android Directory chooser example][1] which uses the androi-dirchooser library. This example detect the SDcard and list all the subfolders and it also detects if the device has morethan one SDcard.
**Part of the code looks like this For full example goto the link** [Android Directory Chooser ][2]

**Helper Methods**
/** * Returns the path to internal storage ex:- /storage/emulated/0 * * @return */ private String getInternalDirectoryPath() { return Environment.getExternalStorageDirectory().getAbsolutePath(); }
/** * Returns the SDcard storage path for samsung ex:- /storage/extSdCard * * @return */ private String getSDcardDirectoryPath() { return System.getenv("SECONDARY_STORAGE"); }
mSdcardLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String sdCardPath; /*** * Null check because user may click on already selected buton before selecting the folder * And mSelectedDir may contain some wrong path like when user confirm dialog and swith back again */
if (mSelectedDir != null && !mSelectedDir.getAbsolutePath().contains(System.getenv("SECONDARY_STORAGE"))) { mCurrentInternalPath = mSelectedDir.getAbsolutePath(); } else { mCurrentInternalPath = getInternalDirectoryPath(); } if (mCurrentSDcardPath != null) { sdCardPath = mCurrentSDcardPath; } else { sdCardPath = getSDcardDirectoryPath(); } //When there is only one SDcard if (sdCardPath != null) { if (!sdCardPath.contains(":")) { updateButtonColor(STORAGE_EXTERNAL); File dir = new File(sdCardPath); changeDirectory(dir); } else if (sdCardPath.contains(":")) { //Multiple Sdcards show root folder and remove the Internal storage from that. updateButtonColor(STORAGE_EXTERNAL); File dir = new File("/storage"); changeDirectory(dir); } } else { //In some unknown scenario at least we can list the root folder updateButtonColor(STORAGE_EXTERNAL); File dir = new File("/storage"); changeDirectory(dir); }

} });

[1]: https://github.com/shivarajp/AndroidDirectoryChooserExample [2]: https://github.com/shivarajp/AndroidDirectoryChooserExample

        
Present in both answers; Present only in the new answer; Present only in the old answer;