• 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Using PixelCopy to take a screenshot

 
Ranch Hand
Posts: 85
3
  • 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
3
  • 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.
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic