tags: Android
Returns NULL is the path error. After multiple attempts, use the following method to solve
1. Create an Assets folder, create a new config.properties file

2.config.properties file content
# Request address
IP=192.168.1.101:8080
loginurl=http://192.168.1.101:8080/assets/login.html
3. Create a package Until, create a new utils.java file

4.Utils.java read configuration file content
public class utils {
public static Properties getNetConfigProperties() {
Properties props = new Properties();
InputStream in = utils.class.getResourceAsStream("/assets/config.properties");
try {
props.load(in);
} catch (IOException e) {
e.printStackTrace();
}
return props;
}
}
5. Use
String loginurl = utils.getNetConfigProperties().getProperty("loginurl");
One of the reasons for this problem may be that in the Layout page, there is an Include quoting block, butterknife and initialized reference block layout, which is caused. Problem code: layout code In...
Source of the problem This week, the error log level file that cannot be customized in the actual project cannot be customized, and the default INFO level log is still printed after the project is sta...
To solve this problem is very simple: windows version press the shortcut key alt + shift + ctrl + s mac:command + ; Enter the module configuration, select the module you are using, click sources, crea...
Yesterday I wanted to use getResourceAsStream to get the content of the json file in the resources, and found that it was always null Finally, I changed the uppercase of the first letter of the file n...
background: I have written a springboot+testng project. The project needs to be run through the mvn test command, but the getResourceAsStream method has been reporting errors and cannot run At that ti...
When connecting to the database, I reported this 500, thinking that there was a problem with the server deployment, and then the java code soon created a new Test test connection database. I found tha...
In system development projects need to call the album, to be able to get a normal return values on other android phone, but Huawei is the return value is null, please see the code below After the ab...
When using com.alibaba.fastjson.support.spring.fastjsonhttpMessageConverter Transition Returns to JSON, it will be omitted to an attribute value of empty NULL. The solution is equipped with the proces...
Use Java to open the picture: Solve Imageio.Read () Returns NULL: In useImageIO.read()The method may encounter a problem, that is, I have entered the image address, howeverImageIO.read()Returning isnu...
directory structure src:reflect/ReflectTest2.java reflect/resource/config.properties The class's getResourceAsStream is relative to the class loader directory path of the current class. The current pa...