0

So I'm programming my first app, and I have a loading screen which shows my logo and a loading bar. This is actually just for the looks. But when I want to take a picture with the camera, and inserting it into an imageview, it goes back to the loading screen, and not to my second screen after pressing ok button in the camera app.

Does anyone know what to do about this?

my code:

second activity:

public void makeFoto(View v) {
    Intent photoIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(photoIntent, CAMERA_PHOTO_REQUEST);
    photoIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

and

protected void onActivityResult(int requestCode, int resultCode, Intent data){
    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode == RESULT_OK){
        if(requestCode == CAMERA_PHOTO_REQUEST){
            Bundle extras = data.getExtras();
            Bitmap bmp = (Bitmap) extras.get("data");
            ImageView imv = (ImageView) findViewById(R.id.imvFoto);
            imv.setImageBitmap(bmp);
            //HttpGetMethod client = new HttpGetMethod();

        }
    }
}

loading screen:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_load_screen);
        (new Thread(){
            @Override
        public void run(){
            for(int i = 0; i<255; i++){
                // next will pause the thread for some time
                try{ sleep(5); }
                   catch(Exception e)

                   { break; }
                }
                startActivity(new Intent(LoadScreen.this,Home.class));
            }
        }).start();
    }
4

0 回答 0