`
fulerbakesi
  • 浏览: 561532 次
文章分类
社区版块
存档分类
最新评论

获取build.prop中的指定属性

 
阅读更多
  // 获取build.prop中的指定属性 
    public static String GetBuildProproperties(String PropertiesName) {     
    	try    {        
    		InputStream is = new BufferedInputStream(new FileInputStream(new File("/system/build.prop")));  
    		BufferedReader br = new BufferedReader(new InputStreamReader(is));    
    		String strTemp = "";        
    		while ((strTemp = br.readLine()) != null)      
    		{// 如果文件没有读完则继续           
    			if (strTemp.indexOf(PropertiesName) != -1)    
    				return strTemp.substring(strTemp.indexOf("=") + 1);       
    		}      
    		br.close();       
    		is.close();         
    		return null;    
    		}catch (Exception e){     
    			if (e.getMessage() != null)  
    				System.out.println( e.getMessage());      
    			else           
    				e.printStackTrace();     
    			return null;    
    			} 
    		} 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics