0

I'd like to take the Screenshot of user homepage Could you please guide me how I could do that Currently I am using

LinearLayout linearLayout  = (LinearLayout )findViewById(R.id.layout);
linearLayout.setDrawingCacheEnabled(true);
Bitmap bitmap= linearLayout.getDrawingCache();

Its working for my views but how I can find the Homepage view and take the screenShot of User homepage.

skaffman
  • 381,978
  • 94
  • 789
  • 754
Shehzad
  • 2,614
  • 13
  • 21

3 Answers3

1

Fortunately, this is not possible, for obvious security and privacy reasons, except perhaps on rooted devices.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • There's a library "Android screenshot Library" It provide the normal screenshot without rooted access. I don't know how... But it starts some native services which i didn't required actually. anyways Suppose my focus is on rooted devices then how it will be possible? – Shehzad Mar 18 '12 at 20:48
1

If by Homepage you mean the rootview of the screen then

getWindow().getDecorView().findViewById(android.R.id.content)

see question 4486034

Community
  • 1
  • 1
connoisseur
  • 497
  • 3
  • 14
  • 1
    By HomePage mean, User's Home page where user's widgets placed. i.e User have placed 2 widgets on his homepage, Weather and clock widget. I want to take the screen shot of this state of user home. – Shehzad Mar 18 '12 at 20:43
  • Basically, as I understand it, most if not all screenshot apps work by: Starting a service, setting up a triggering mechanism (shake, press camera, timer, etc), and capturing -WHATEVER- is on the screen when triggered. You would need to know what screen your user is on when you trigger the capture. Thats why it should be user initiated. – connoisseur Mar 18 '12 at 22:16
  • So its only possible if the user initiate it?. Please tell me one more thing Suppose my widget is placed on user home. When user clicked that widget then is it possible to trigger the capture for user home? – Shehzad Mar 19 '12 at 04:20
0

I believe you can only do this on rooted devices using adb or something along those lines, Ive seen it done before, just not sure how, try finding out how to use ddms using an app on the phone

FabianCook
  • 18,692
  • 14
  • 59
  • 110