java 获取黑屏信息保存在list中,截取字符执行

ArrayList<String> list1 = new ArrayList<String>();

Process p = Runtime.getRuntime().exec("adb shell settings get secure default_input_method");
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            list1.clear();
             while ((line = br.readLine()) != null) {
             System.out.println(line+"oooooooooo");         
             list1.add(line);
             }            
            } catch (IOException e1) {
             // TODO Auto-generated catch block
             e1.printStackTrace();
            }

String temp2=list1.get(0).toString().substring(0,list1.get(0).toString().length());//去掉第0个字符
       String[] str1=temp2.split(",");//以,号截取
       System.out.println(str1[0]+"333");//取第0个字符

截取前[com.asus.ime/.IME, ]

截取后com.asus.ime/.IME

原文地址:https://www.cnblogs.com/dreamy890322/p/5771996.html