• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Using PixelCopy to take a screenshot

Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I'm working on an Android Code Labs challenge (the first one) , that requires you to take a screen shot of an activity and enailing it to someone.

There's only one activity and it displays "Hello World".

So I decided to use API class PixelCopy - specifically the method:
PixelCopy.request(Window source, Bitmap dest, PixelCopy.OnPixelCopyFinishedListener listener, Handler listenerThread)

I understand that PixelCopy.OnPixelCopyFinishedListener provides this callback method: onPixelCopyFinished(int copyResult) where int copyResult is PixelCopy.SUCCESS etc if the copy operation was successful.

I'm getting stuck because I don't understand how I should pass PixelCopy.OnPixelCopyFinishedListener PixelCopy.request(). I mean what does the variable listener refer to ? what is its type ? what should listener be ?)

I know that there is an easier way and that it to use API class Screenshot, Screenshot.capture() but I am a glutton for punishment.

The code (as far as I've got with it) is below:

Mohammed Azeem
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I was asking a muddled question.

I have thoroughly studied the official oracle tutorial on nested classes and nested static classes and now I understand.
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic