Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:25:36+00:00 2026-06-05T16:25:36+00:00

I am taking a picture from android phone camera and placing it on imageview.

  • 0

I am taking a picture from android phone camera and placing it on imageview. now I want to take that src of imageview so that I could upload it to server. How can I take src of imageview?

Here is my code

public class CameraActivity extends Activity implements View.OnClickListener {
ImageView iv;
Button bCapture, bSetWall;
Intent i;
int CameraResult = 0;
Bitmap bmp;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    initialize();
    InputStream is = getResources().openRawResource(R.drawable.ic_launcher);
    bmp = BitmapFactory.decodeStream(is);
}

private void initialize() {
    iv = (ImageView)findViewById(R.id.ivCamera);
    bCapture = (Button)findViewById(R.id.bCapture);
    bSetWall = (Button)findViewById(R.id.bSetWall);
    bCapture.setOnClickListener(this);
    bSetWall.setOnClickListener(this);
}

public void onClick(View v) {
    switch(v.getId()) {
    case R.id.bCapture:
        i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(i, CameraResult);
        break;
    case R.id.bSetWall:
        try {
            getApplicationContext().setWallpaper(bmp);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        break;
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode == RESULT_OK) {
        Bundle extras = data.getExtras();
        bmp = (Bitmap) extras.get("data");
        iv.setImageBitmap(bmp);
        //String v = iv.getTag().toString();
        //Toast.makeText(getApplicationContext(), v, Toast.LENGTH_LONG).show();
    }
}


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:25:37+00:00Added an answer on June 5, 2026 at 4:25 pm

    convert the bitmap into byte array and send it to the server

    Bitmap bmp = intent.getExtras().get("data");
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
    byte[] byteArray = stream.toByteArray();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the PhoneGap camera API to take a picture. After taking the
Exposure values from camera can be acquired when you take picture (without saving it
I am new to iphone app development, while taking picture from camera I am
I'm trying to take a picture from the Camera using intent with onActivityResult but
I am taking a picture trough the camera and I want to change the
I want to give scale in and scale out option while taking picture from
I am taking pictures from my custom UIImagePicker camera and saving the images inside
I am taking pictures from the iPhone camera using the UIImagePickerController Class. I am
I am taking a high resolution picture through the default camera activity(using intent.put Extras
So far I have my app taking a picture AndroidCamera.java using the camera and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.