2014-02-20 42 views

回答

0

獲得從該位置的數據文件/sys/class/display/display0.hdmi/connect.If在文件中的數據是0 HDMI是不如果其1個其connected.Try此方法連接。

嘗試 {

File file = new File("/sys/class/display/display0.hdmi/connect") 
InputStream in = new FileInputStream(file); 
byte[] re = new byte[32768]; 
int read = 0; 
while ((read = in.read(re, 0, 32768)) != -1) 
{ 
    String string="Empty"; 
    string = new String(re, 0, read); 
    Log.v("String_whilecondition","string="+string); 
    result = string; 

} 
    in.close(); 
    } 
    catch (IOException ex) 

    { 

      ex.printStackTrace(); 

     } 
+0

我認爲這取決於在設備上,我看不到我的設備上的/ SYS /班/顯示。 –

+0

是的,這取決於製造商,但大多數設備將擁有這些文件。 –