`

How to capture screen with coding

 
阅读更多
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  currentView = findViewById(R.id.screen);
  clickBtn = findViewById(R.id.click_button);
  clickBtn.setOnClickListener(this);
  }

  public void onClick(View v){
  View screen = currentView.getRootView();
  System.out.println("Root view");
  screen.setDrawingCacheEnabled(true);
  Bitmap shot = screen.getDrawingCache();
  if(shot != null)
  System.out.println("shot is not null");

  FileOutputStream fos = null;
  try {
  fos = new FileOutputStream(pathname);
  if(fos != null){
  shot.compress(Bitmap.CompressFormat.PNG, 100, fos);
  fos.flush();
  fos.close();
  }
  }catch (FileNotFoundException e){
  e.printStatckTrace();
  }catch (IOException e){
  e.printStatckTrace();
  }
  }

 

http://topic.csdn.net/u/20100108/15/3722f8bd-ef5c-4fd4-8850-1abf3cb9028d.html

http://code.neenbedankt.com/how-to-render-an-android-view-to-a-bitmap

http://stackoverflow.com/questions/6895230/how-to-display-image-in-mail-on-android

http://www.anddev.org/other-coding-problems-f5/how-to-capture-screen-with-coding-t3755.html

分享到:
评论

相关推荐

    Introduction to Cryptography with Coding Theory(Wade Trappe)

    首先,书名《Introduction to Cryptography with Coding Theory》即《密码学与编码理论导论》,表明这是一本介绍密码学基础理论和编码理论的入门书籍。作者Wade Trappe隶属于无线信息网络实验室和电气与计算机工程系...

    Coding Games in Python

    Each chapter in Coding Games in Python shows how to construct a complete working game in simple numbered steps. The book teaches how to use freely available resources, such as PyGame Zero and Blender,...

    SOLUTIONS MANUAL FOR AN INTRODUCTION TO CRYPTOGRPHY WITH CODING

    标题“SOLUTIONS MANUAL FOR AN INTRODUCTION TO CRYPTOGRPHY WITH CODING”指的是《一种密码学与编码理论介绍的习题解答手册》。本书为《密码学与编码理论》第二版的配套解答册,而密码学与编码理论是信息安全领域...

    Introduction To Digital Audio Coding And Standards

    Introduction To Digital Audio Coding And Standards

    Coding project in python

    Using fun graphics and easy-to-follow instructions, Coding Projects in Python is a straightforward, visual guide that shows young learners how to build their own computer projects using Python, an ...

    密码学概论 原书名:Introduction to CRYPTOGRAPHY with CODING THEORY

    本书全面讲解了密码学的基本知识以及...在此基础上,本书对数字签名、数字现金等应用问题作了较为详细的阐述。另外,本书每章都给出了相应的习题,而且在附录中给出了用Mathematica、Maple和MATLAB实现的相关示例。 ...

    The Python Book-The Ultimate Guide to Coding with Python

    The Python Book-The Ultimate Guide to Coding with Python Learn to use Python Program games Get creative with Pi

    How.to.Use.Objects.Code.and.Concepts.0321995546

    While most developers today use object-oriented languages, the full power of objects is available only to those with a deep understanding of the object paradigm. How to Use Objects will help you gain ...

    Coding Projects in Scratch

    Kids can animate their favorite characters, build games to play with friends, create silly sound effects, and more with Coding Projects in Scratch. All they need is a desktop or laptop with Adobe 10.2...

    Network Coding Fundamentals

    fits, how network codes are designed and how much it costs to deploy networks implementing such codes, and finally, whether there are meth- ods to deal with cycles and delay that are present in all ...

    Java.Interview.Guide.How.to.Build.Confidence.With.pdf

    Java.Interview.Guide.How.to.Build.Confidence.With.a.Solid.Understanding.of.Core.Java.Principles.B015HF9SJQ.pdf Java.Interview.Guide.How.to.Build.Confidence.With.a.Solid.Understanding.of.Core.Java....

    Begin to Code with Python

    Understand the basics of coding, from simple data storage to more complex and useful programs Discover how Python works using the Visual Studio environment Master advanced techniques, including ...

    Coding.Projects.in.Python.2017.pdf

    Perfect for kids ages 10 and over who are ready to take a second step after Scratch, Coding Projects in Python teaches kids how to build amazing graphics, fun games, and useful apps. All they need is ...

    introduction to crptography with coding theory (1st edition) djvu

    本书全面讲解了密码学的基本知识以及...在此基础上,本书对数字签名、数字现金等应用问题作了较为详细的阐述。另外,本书每章都给出了相应的习题,而且在附录中给出了用Mathematica、Maple和MATLAB实现的相关示例。 ...

    Learn CakePHP: With Unit Testing, 2nd Edition

    How to work with fixtures, model tests, text callbacks, controller tests, and more How to do mocks, test suites, testing from the command line and more How to work with code coverage, fixtures data, ...

    Learn to Program with Python

    Learn how to re-use code by building your own modules Use Python's built-in data structures and packages to represent and make use of complex data from the Internet Who this book is for: This book ...

    Learn JavaScript with p5.js_Coding for Visual Learners-Apress(2018).pdf

    viable knowledge to get you running with coding. This is the book that I wished I had available when I was learning coding myself. If you are an artist or a visual designer, this book is perfect for ...

Global site tag (gtag.js) - Google Analytics