2

I mean not in the app but anywhere, suppose user open my app and then moved it whatsapp can I get the root view of that activity.

I tried this

private Bitmap takeScreenshot(){
        View rootView = findViewById(android.R.id.content).getRootView();
        rootView.setDrawingCacheEnabled(true);
        return rootView.getDrawingCache();
    }

but it return the view of activity where it is defined, is it possible to obtain other app root view?

Tehleel Mir
  • 743
  • 8
  • 27
  • This would have serious security implications if it was allowed. May I ask why you want to? Just to take screenshots? – Henry Twist Apr 12 '21 at 12:03
  • yes, i tried every question here on SO, but nothing is pointing out the good solution. That's why my mind got crazy and asked this question – Tehleel Mir Apr 12 '21 at 16:33
  • Well [this post](https://stackoverflow.com/q/11271436/10082297) seems to cover it pretty well, specifically [this answer](https://stackoverflow.com/a/30586140/10082297) for Android 5.0+. – Henry Twist Apr 12 '21 at 16:39

0 Answers0