Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the following code to solve the issues :</p> <p>Your First Activity:</p> <pre><code>private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_first); Button take_photo = (Button) findViewById(R.id.btn_capture); take_photo.setOnClickListener(new OnClickListener() { public void onClick(View v) { // create Intent to take a picture and return control to the calling application Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // start the image capture Intent startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { Bitmap imageData = null; if (resultCode == RESULT_OK) { imageData = (Bitmap) data.getExtras().get("data"); Intent i = new Intent(this, SecondActivity.class); i.putExtra("name", imageData ); startActivity(i); } else if (resultCode == RESULT_CANCELED) { // User cancelled the image capture } else { // Image capture failed, advise user } } } </code></pre> <p>and second Activity:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); Bitmap bitmap = getIntent().getExtras().getParcelable("name"); ImageView view = (ImageView) findViewById(R.id.view_photo); view.setImageBitmap(bitmap); } </code></pre> <p>and in Manifest.xml file use the permission: </p> <pre><code>&lt;uses-feature android:name="android.hardware.camera" /&gt; </code></pre> <p>I hope this will work fine </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload