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 8064725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:27:23+00:00 2026-06-05T11:27:23+00:00

I want to take a picture from a non-activity Thread (a web server running

  • 0

I want to take a picture from a non-activity Thread (a web server running on the device).

In order to do this, I wanted to have a Service bound to the Application, that I could call which would take a picture, and return the Bitmap when done. But it looks like I can’t do that because for security purposes Android forbids to take picture without showing a preview (even with a dummy preview like shown on the accepted answer here, on some devices)

I then wanted to have an Activity that takes the picture for me, with a real preview, but I can’t think of any way to do this either because:

  • I can’t get the Bitmap back because I can’t call startActivityForResult() as my web server is not an Activity, so I can’t override onActivityResult(). (The webServer just has a reference of the instance of the Application)

  • I can’t just pass the HttpRequest along with the Intent for the Activity to respond to it, because the Response object is not parcellable?

How would you do something like that in the most logical/elegant way possible?

  • 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-05T11:27:24+00:00Added an answer on June 5, 2026 at 11:27 am

    I sincerely hope that this is for personal use only, and that you are not seriously considering putting a Web server — with an open, unprotected server socket — on lots of mobile devices. If you are, I hope you have a well-financed legal defense fund.

    That being said:

    Step #1: Have your Web daemon service register a BroadcastReceiver with LocalBroadcastManager

    Step #2: As needed, have your service call startActivity() to bring up your picture-taking activity

    Step #3: Have your picture-taking activity send a broadcast through LocalBroadcastManager for your Web daemon service, with the JPEG data either in an Intent extra, or perhaps just as a static data member if you’re sure you will be able to process it before taking the next image.

    The use of LocalBroadcastManager avoids shipping the Intent (and its huge bitmap extra) to the OS and back to your process again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my Activity, i want to take a picture with android.hardware.Camera. The code (see
I want to take a picture or select an existing picture from the users
Searched the whole web for this with no solution... I want to take a
I want change background picture(a div) with javascript that I will take from database.
I want to take a picture from the android emulator through my application when
I want my Android app to take a picture, as part of something larger
I want to take an image from the UIImagePickerController and put it on a
I want take a section of a picture, for example the middle of a
I just like images I want to separate the picture from the page. I
I want to give scale in and scale out option while taking picture from

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.