sd-card

How to detect when an App is force moved to SD-Card on rooted Android

时间秒杀一切 提交于 2020-01-06 05:47:37
问题 I have declared my App as internalonly, yet some rooted users move it to SD-Card. How can I detect at run-time that this has happened? I do not trust the information that packagemanager is reporting as these are rooted phones and my app should not had been moved to SD-card anyways. Thanks! 回答1: Have the application open /proc/self/maps and look for an entry that is an apk file and look at its path. Why exactly are you concerned about this? Hopefully it is because of a functional reason, such

Android+Eclipse: Can't push files to SD Card [duplicate]

痞子三分冷 提交于 2020-01-06 03:42:04
问题 This question already has answers here : Android Emulator sdcard push error: Read-only file system (20 answers) Closed 6 years ago . Trying to push files to sd card via eclipse. When I pull up my DDMS view, I have 3 main directories on the device: /data /mnt /system The only SDcard folder is located at /mnt/sdcard and it has permissions d-------- . I can't push anything to it, with the error: Failed to push selection: Read-only file system I had deleted and remade the device many times, with

How to create folder in sdcard in android

*爱你&永不变心* 提交于 2020-01-03 14:43:09
问题 I want to make folders in my sdcard and I have used the code below: public class Screen extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.welcome); operateOnFirstUsage(); } private void operateOnFirstUsage() { String state = Environment.getExternalStorageState(); Log.d("Media State", state); if (Environment.MEDIA_MOUNTED.equals(state)) { File appDirectory = new File( Environment

Getting the path to SD card

冷暖自知 提交于 2020-01-02 11:06:46
问题 Please read the whole post before down-voting and/or marking it as a duplicate! I'm working on an app that reads files from within a specific folder on the user's phone - either from the SD card (if there's one) or from the built in storage. Yes, the "READ_EXTERNAL_STORAGE" is mentioned in the manifest and I'm also handling the permission popup for API>23. I used to simply use File folder = new File(Environment.getExternalStorageDirectory(), "myfolder"); to get the path of the folder that is

Android Delete Image from SD Card with OnClick

柔情痞子 提交于 2020-01-02 06:33:50
问题 I'm trying to simply delete an image from a simple app. I have it so that when you click on the image, it'll bring up an a dialog with the option to delete it. I thought this would just be something simple, but everything I have been trying doesn't seem to be doing anything. Below is my code. Any ideas would be greatly appreciated. delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub int id = viewIt.getId(); File

Android Delete Image from SD Card with OnClick

独自空忆成欢 提交于 2020-01-02 06:33:22
问题 I'm trying to simply delete an image from a simple app. I have it so that when you click on the image, it'll bring up an a dialog with the option to delete it. I thought this would just be something simple, but everything I have been trying doesn't seem to be doing anything. Below is my code. Any ideas would be greatly appreciated. delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub int id = viewIt.getId(); File

showing image from sdcard with webview not working

倾然丶 夕夏残阳落幕 提交于 2020-01-01 12:32:14
问题 I have downloaded map750.png file in the root of sdcard, but when I try to show it within a webview with some text, only the text is shown. Could you help me to find what is wrong in the code? thanks. setContentView(R.layout.webview); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setBuiltInZoomControls(true); String html = "<html><head></head><body><p>hello</p><img src

how to get the file names stored in sd card in android

为君一笑 提交于 2019-12-31 09:49:39
问题 i have a folder in sd card which contains several files. now i need to get the names of that files. can anybody have any idea how to get the file names stored in sd card? any help will be appreciative. thanks a lot. 回答1: Environment.getExternalStorageDirectory will give you a File corresponding to the SDCARD. Then you'll just have to use File methods. That should be something like that : File sdCardRoot = Environment.getExternalStorageDirectory(); File yourDir = new File(sdCardRoot, "yourpath

Detecting if SD card present or not always returns true

自闭症网瘾萝莉.ら 提交于 2019-12-31 06:59:45
问题 I am developing an android app, where i am trying to check if SD card is present or not to perform a specfic task.I am using the code from the below link to check it. Check whether the SD card is available or not programmatically The problem is , the code is working fine for many of my phones, but on my Galaxy S , even if i dont have a SD card, the isSDcardpresent is always a true. Not sure what the problem is, Please help! Thanks! 回答1: There is always an 'external' storage directory, even

Detecting if SD card present or not always returns true

一笑奈何 提交于 2019-12-31 06:59:28
问题 I am developing an android app, where i am trying to check if SD card is present or not to perform a specfic task.I am using the code from the below link to check it. Check whether the SD card is available or not programmatically The problem is , the code is working fine for many of my phones, but on my Galaxy S , even if i dont have a SD card, the isSDcardpresent is always a true. Not sure what the problem is, Please help! Thanks! 回答1: There is always an 'external' storage directory, even