In Android in the Studio to write a simple app, has encountered the following a series of problems, consult everybody,
1. This simple app, only an activity, similar to the HelloWorld, just add a button click processing,
Compiler generated apk, suggests the following warning:
MainActivity. Java USES or covered the outdated API,
Note: for more information, please use - Xlint: deprecation recompile,
Excuse me, specific how to find, which is the use of the API caused?
2. The App reference website document,
1). File_paths. XML are defined as follows,
Document says "files - path" represents files in the files/subdirectory of your app 's internal storage area. This subdirectory is the same as the value returned by the Context. GetFilesDir ().
Assuming that the app package id is com. Mydomain. Myapp, so the images folder, in the actual physical path on the android phones, it is
Equipment storage/data/data/com mydomain. Myapp/files/images?
This folder, using the "document management" on the phone can't see; With the Android Device in the Studio File Explorer to see?
2). The XML file, similar files - path, can use the external - path represents files in the root of the external storage area, on behalf of SD storage; So, what kind of representative equipment storage root directory (the root of the internal storage area)?
3). The website in the document code is as follows,
The File imagePath=new File (Context. GetFilesDir (), "images");
The File newFile=new File (imagePath, "default_image. JPG");
Uri contentUri=getUriForFile (getContext (), "com. Mydomain. Fileprovider", newFile);
I put the above three lines of code, the button's onClick (), compile-time error:
The first line of error: error: unable to reference from the static context non-static methods getFilesDir ()
the third line error: error: incompatible types: AccessControlContext cannot be converted to the Context
Understand the classmate say, the two error is how to return a responsibility?
Thank you shameless! You have a nice weekend!