Bild wird nicht in der imageView angezeigt

C

Chris92

Fortgeschrittenes Mitglied
0
Hallo ich bins erneut (*schäm*)

Aus irgendeinem Grund, hoffte ich würds alleine herausfinden :( wird mein Bild das ich mit der Kamera geschossen in der ImageView auf meinem Tablet hab nicht angezeigt. Jedoch komischerweise funktioniert die App reibungslos im Emulator Oo was mich auch sehr wundert.

Hier mal der ganze Code meiner app:

.Java Class:
-------------------

Code:
package lu.english.application;

import java.io.File;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class PictureActivity extends Activity {
    

    /** Called when the activity is first created. */
    
    /**
     * Variable Initialisation
     */
     private Button btnPicture;
     private ImageView imgView;
     private EditText edtText;
     private static final int DIALOG_PROGRESSDIALOG = 1;
     private static final int MAX_PROGRESS = 10;
     private static int TAKE_PICTURE = 1337;
     private Uri outputFileUri;

     @Override
     public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.picture);
        initialize();
        
        btnPicture.setOnClickListener(new OnClickListener (){
           public void onClick(View view)
           { 
               saveFullImage();
           }
       });  
} 
     
        private void saveFullImage() {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            File file = new File(Environment.getExternalStorageDirectory(),
            "test.jpg");
            outputFileUri = Uri.fromFile(file);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
            startActivityForResult(intent, TAKE_PICTURE);
        }
        
        @Override
        protected void onActivityResult(int requestCode,
            int resultCode, Intent data) {
            if (requestCode == TAKE_PICTURE) {
                imgView.setImageURI(outputFileUri);    
            }    
        }
    
    public void initialize(){
          btnPicture = (Button) findViewById(R.id.btnPicture);
          edtText = (EditText)findViewById(R.id.edttext);
          imgView = (ImageView) findViewById(R.id.imageView1);
    }   
}
.XML File
-------------------

Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="640dp"
            android:layout_height="650dp" />

        <EditText
            android:id="@+id/edttext"
            android:layout_width="640dp"
            android:layout_height="650dp"
            android:autoText="true"
            android:ems="10"
            android:focusable="false"
            android:gravity="center"
            android:singleLine="false" >
        </EditText>
      
    </LinearLayout>  
     <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@android:drawable/bottom_bar"
            android:gravity="center_vertical" 
            android:layout_alignParentBottom="true"         
            android:layout_alignParentLeft="true">

            <Button
                android:id="@+id/btnPicture"
                 android:layout_width="256dp"
                android:layout_height="wrap_content"
                android:text="Take Picture" />
        </LinearLayout>
</RelativeLayout>
Manifest File
-----------------
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="lu.english.application"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="15" />
         <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
           
        </activity>
    <activity android:name=".PictureActivity" android:label="PictureActivity"></activity>
</activity>
    </application>

</manifest>
Die Startactivity hab ich jetzt nicht mit kopiert, weil diese ja nichts mit dem Problem zu tun hat.
Ich hoffe sehr jemand von euch kann mir dabei helfen :(

MFG

Chris92
 
Hat dazu niemand eine Antwort? :(
 
sorry vertan
 
hast du es inzwischen gelöst?
 

Ähnliche Themen

M
  • MikelKatzengreis
Antworten
10
Aufrufe
219
swa00
swa00
B
Antworten
6
Aufrufe
1.051
jogimuc
J
M
Antworten
3
Aufrufe
162
moin
M
Zurück
Oben Unten