When developing Android, what should I do if the phone is rooted, but there is still no data/data path in DDMS?
You can use the cmd command prompt to set permissions for each folder:
Open cmd and enter
adb shell Enter—>
su Enter—>
chmod 777 /data Enter—>
chmod 777 /data/data Enter—>
chmod 777 /data/data Enter—>
chmod 777 /data/data/your app package name Enter—>
Finish!
If you want to create a new folder in your package name, refer to the following command:
Open cmd and enter
adb shell Enter—>
adb root Enter—>
cd data/data/your qpp package name Enter—>
mkdir XXX (the name of the folder you want to create) Enter—>
Finish!
ps: Android to get the path directory method and determine whether the directory exists, create a directory
Common methods of Environment:
* method:getDataDirectory() explain:return File ,Get Android Data Directory。 * method:getDownloadCacheDirectory() explain:return File ,Get Android download/Cache content directory。 * method:getExternalStorageDirectory() explain:return File ,Get外部存储目录即 SDCard * method:getExternalStoragePublicDirectory(String type) explain:return File ,Take a high-end public external memory directory to place certain types of files * method:getExternalStorageState() explain:return File ,Get外部存储设备的当前状态 * method:getRootDirectory() explain:return File ,Get Android root directory public void getSDPath(){ File sdDir = null; File sdDir1 = null; File sdDir2 = null; boolean sdCardExist = () .equals(.MEDIA_MOUNTED); //Judge whether the SD card existsif (sdCardExist) { sdDir = ();//Get and directorysdDir1 = (); sdDir2 =(); } ("getExternalStorageDirectory(): "+()); ("getDataDirectory(): "+()); ("getRootDirectory(): "+()); } //Judge whether the file (folder) under a path existspublic class IsExist { public static void main(String[] args) { isExist("e://12"); } /** * * @param path folder path */ public static void isExist(String path) { File file = new File(path); //Judge whether the folder exists, and if it does not exist, create a folderif (!()) { (); } } }
1. Create a folder on the SD card
public class make extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { (savedInstanceState); setContentView(); File sd=(); String path=()+"/notes"; File file=new File(path); if(!()) (); }