[java]view plain copy print ?
1. <spanstyle="font-size:18px;">packagecom.demo;
2.
3. importjava.io.BufferedOutputStream;
4. importjava.io.File;
5. importjava.io.FileNotFoundException;
6. importjava.io.FileOutputStream;
7. importjava.io.IOException;
8. importjava.util.Calendar;
9. importjava.util.Locale;
10.
11. importandroid.app.Activity;
12. importandroid.content.Intent;
13. importandroid.graphics.Bitmap;
14. importandroid.os.Bundle;
15. importandroid.os.Environment;
16. importandroid.provider.MediaStore;
17. importandroid.text.format.DateFormat;
18. importandroid.util.Log;
19. importandroid.view.View;
20. importandroid.view.View.OnClickListener;
21. importandroid.widget.Button;
22. importandroid.widget.ImageView;
23. importandroid.widget.Toast;
24.
25. publicclassMyCameraActivityextendsActivity{
26. /**Calledwhentheactivityisfirstcreated.*/
27. privateButtonbutton;
28.
29. @Override
30. publicvoidonCreate(BundlesavedInstanceState){
31. super.onCreate(savedInstanceState);
32. setContentView(R.layout.main);
33. button=(Button)findViewById(R.id.button);
34. button.setOnClickListener(newOnClickListener(){
35.
36. @Override
37. publicvoidonClick(Viewv){
38. //TODOAuto-generatedmethodstub
39. Intentintent=newIntent(MediaStore.ACTION_IMAGE_CAPTURE);
40.
41. startActivityForResult(intent,1);
42. }
43. });
44. }
45.
46. @Override
评论0
最新资源