Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid app showing black screen while waiting HTTP response
    primarykey
    data
    text
    <p>I have been trying to develop an Android app which lets the user take a picture and then send the image over HTTP. I am using the native camera.</p> <p>After the user takes the picture and hits the save button, I get a black screen while the app sends the info and waits for a response. I would rather display a progressdialog but no matter what I tried, the black screen stays there and the progressdialog can only be seen after getting the response and hitting the back button. I have tried using setContentView() to no avail. The threads are for HTTP request. </p> <p>Here is the code for the camera start and finish:</p> <pre><code>protected void startCameraActivity() { File file = new File( _path ); Uri out = Uri.fromFile( file ); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE ); intent.putExtra( MediaStore.EXTRA_OUTPUT, out ); startActivityForResult( intent, 0 ); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch( resultCode ) { case 0: break; case -1: m_ProgressDialog = ProgressDialog.show(MainActivity.this, "Please wait...", "Uploading data ...", true, true); onPhoto(); break; } } protected void onPhoto() { taken = true; PipedOutputStream pos = new PipedOutputStream(); PipedInputStream pis = null; try { pis = new PipedInputStream(pos); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Sender sender = new Sender(pos); Receiver receiver = new Receiver(pis); sender.start(); receiver.start(); try { sender.join(); receiver.join(); try { field.setText(receiver.getIn().readUTF()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { pis.close(); pos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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