code camera android studio application source

Solutions on MaxInterview for code camera android studio application source by the best coders in the world

showing results for - "code camera android studio application source"
Christal
20 Apr 2016
1import android.content.Intent;
2import android.graphics.Bitmap;
3import android.support.v7.app.AppCompatActivity;
4import android.os.Bundle;
5import android.view.View;
6import android.widget.Button;
7import android.widget.ImageView;
8
9public class MainActivity extends AppCompatActivity {
10
11    Button btn_one;
12    ImageView image_one;
13    @Override
14    protected void onCreate(Bundle savedInstanceState) {
15        super.onCreate(savedInstanceState);
16        setContentView(R.layout.activity_main);
17
18        btn_one=(Button)findViewById(R.id.button);
19        image_one=(ImageView)findViewById(R.id.imageView);
20
21        btn_one.setOnClickListener(new View.OnClickListener() {
22            @Override
23            public void onClick(View v) {
24                Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
25                startActivityForResult(intent, 0);
26            }
27        });
28    }
29
30    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
31        // TODO Auto-generated method stub
32        super.onActivityResult(requestCode, resultCode, data);
33
34        Bitmap bp = (Bitmap) data.getExtras().get("data");
35        image_one.setImageBitmap(bp);
36    }
37}