Is it possible to listen for entries to the log? Ie is there a broadcast intent for when a log ent开发者_如何学Gory is appended?
there is no Intent.
use below code :
try
    {
        Process mLogcatProc = null;
        BufferedReader reader = null;
        mLogcatProc = Runtime.getRuntime().exec(new String[]{"logcat", "-d"});
        reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream()));
        String line;
        final StringBuilder log = new StringBuilder();
        String separator = System.getProperty("line.separator"); 
        while ((line = reader.readLine()) != null)
        {
            log.append(line);
            log.append(separator);
        }
        String w = log.toString();
        Toast.makeText(getApplicationContext(),w, Toast.LENGTH_LONG).show();
    }
    catch (Exception e) 
    {
        Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
    }
and you will need it's permission :
android.permission.READ_LOGS
If by "the log" you mean LogCat, no, there are no broadcast Intents for appending entries to LogCat.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论