1

このコードを使用して、ギャラリーからアプリケーションに画像をアップロードできるようにしました。しかし、問題は、アプリケーションがギャラリーを開こうとすると、エラーを強制的に閉じることです。

このエラーの解き方がわからないので教えてください

private static final int SELECT_PICTURE = 1;
    private String selectedImagePath; 
    private ImageView img;  
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);    
        setContentView(R.layout.main);  
        img = (ImageView)findViewById(R.id.imageView1);     
        ((Button) findViewById(R.id.button1)).setOnClickListener(new OnClickListener(){
            public void onClick(View arg0) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent,"SelectPicture"), SELECT_PICTURE);}});
          }    
    public void onActivityResult(int requestCode, int resultCode, Intent data) { 

        if (resultCode == RESULT_OK) {if (requestCode == SELECT_PICTURE)

        {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri); 
            System.out.println("Image Path : " + selectedImagePath);
            img.setImageURI(selectedImageUri);  
            }     
        }  }
                    public String getPath(Uri uri) {  
        String[] projection = { MediaStore.Images.Media.DATA }; 
        Cursor cursor = managedQuery(uri, projection, null, null, null); 
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);   
        cursor.moveToFirst();       
        return cursor.getString(column_index);}}

ここに私の LogCat があります

06-04 14:41:06.236: D/AndroidRuntime(9655): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
06-04 14:41:06.236: D/AndroidRuntime(9655): CheckJNI is ON
06-04 14:41:07.906: D/AndroidRuntime(9655): Calling main entry com.android.commands.pm.Pm
06-04 14:41:08.396: D/dalvikvm(282): GC_EXPLICIT freed 5K, 5% free 6243K/6531K, paused 13ms+5ms
06-04 14:41:08.418: W/ActivityManager(80): No content provider found for: 
06-04 14:41:08.497: W/ActivityManager(80): No content provider found for: 
06-04 14:41:08.546: D/PackageParser(80): Scanning package: /data/app/vmdl881881834.tmp
06-04 14:41:08.776: I/PackageManager(80): Removing non-system package:imag.imo.isithombe
06-04 14:41:08.776: I/ActivityManager(80): Force stopping package imag.imo.isithombe uid=10045
06-04 14:41:08.776: I/Process(80): Sending signal. PID: 6434 SIG: 9
06-04 14:41:08.776: I/ActivityManager(80):   Force finishing activity ActivityRecord{409fd970 imag.imo.isithombe/.ImagggggggActivity}
06-04 14:41:08.901: I/WindowManager(80): WIN DEATH: Window{40faeaa8 imag.imo.isithombe/imag.imo.isithombe.ImagggggggActivity paused=true}
06-04 14:41:09.798: D/PackageManager(80): Scanning package imag.imo.isithombe
06-04 14:41:09.798: I/PackageManager(80): Package imag.imo.isithombe codePath changed from /data/app/imag.imo.isithombe-2.apk to /data/app/imag.imo.isithombe-1.apk; Retaining data and using new
06-04 14:41:09.819: I/PackageManager(80): Unpacking native libraries for /data/app/imag.imo.isithombe-1.apk
06-04 14:41:09.915: D/installd(35): DexInv: --- BEGIN '/data/app/imag.imo.isithombe-1.apk' ---
06-04 14:41:10.755: D/dalvikvm(9664): DexOpt: load 100ms, verify+opt 327ms
06-04 14:41:10.776: D/installd(35): DexInv: --- END '/data/app/imag.imo.isithombe-1.apk' (success) ---
06-04 14:41:10.785: W/PackageManager(80): Code path for pkg : imag.imo.isithombe changing from /data/app/imag.imo.isithombe-2.apk to /data/app/imag.imo.isithombe-1.apk
06-04 14:41:10.785: W/PackageManager(80): Resource path for pkg : imag.imo.isithombe changing from /data/app/imag.imo.isithombe-2.apk to /data/app/imag.imo.isithombe-1.apk
06-04 14:41:10.785: D/PackageManager(80):   Activities: imag.imo.isithombe.ImagggggggActivity
06-04 14:41:10.799: I/ActivityManager(80): Force stopping package imag.imo.isithombe uid=10045
06-04 14:41:11.455: I/installd(35): move /data/dalvik-cache/data@app@imag.imo.isithombe-1.apk@classes.dex -> /data/dalvik-cache/data@app@imag.imo.isithombe-1.apk@classes.dex
06-04 14:41:11.475: D/PackageManager(80): New package installed in /data/app/imag.imo.isithombe-1.apk
06-04 14:41:11.885: I/ActivityManager(80): Force stopping package imag.imo.isithombe uid=10045
06-04 14:41:12.635: D/dalvikvm(80): GC_EXPLICIT freed 1040K, 18% free 14554K/17735K, paused 9ms+42ms
06-04 14:41:12.985: W/ActivityManager(80): Unable to launch app com.android.providers.contacts/10000 for broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:imag.imo.isithombe flg=0x10000010 (has extras) }: process is bad
06-04 14:41:12.985: W/ActivityManager(80): finishReceiver called but none active
06-04 14:41:13.006: W/ActivityManager(80): Unable to launch app com.android.contacts/10000 for broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:imag.imo.isithombe flg=0x10000010 (has extras) }: process is bad
06-04 14:41:13.006: W/ActivityManager(80): finishReceiver called but none active
06-04 14:41:13.055: D/PackageManager(80): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
06-04 14:41:13.147: D/PackageManager(80): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
06-04 14:41:13.225: D/PackageManager(80): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
06-04 14:41:13.245: D/PackageManager(80): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
06-04 14:41:13.275: W/ActivityManager(80): Unable to launch app com.android.providers.contacts/10000 for broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:imag.imo.isithombe flg=0x10000010 (has extras) }: process is bad
06-04 14:41:13.275: W/ActivityManager(80): finishReceiver called but none active
06-04 14:41:13.625: W/ActivityManager(80): Unable to launch app com.android.contacts/10000 for broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:imag.imo.isithombe flg=0x10000010 (has extras) }: process is bad
06-04 14:41:13.657: W/ActivityManager(80): finishReceiver called but none active
06-04 14:41:13.665: W/ActivityManager(80): Unable to launch app com.android.providers.contacts/10000 for broadcast Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:imag.imo.isithombe flg=0x10000010 (has extras) }: process is bad
06-04 14:41:13.665: W/ActivityManager(80): finishReceiver called but none active
06-04 14:41:13.665: W/ActivityManager(80): Unable to launch app com.android.contacts/10000 for broadcast Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:imag.imo.isithombe flg=0x10000010 (has extras) }: process is bad
06-04 14:41:13.680: W/ActivityManager(80): finishReceiver called but none active
06-04 14:41:13.725: W/RecognitionManagerService(80): no available voice recognition services found
06-04 14:41:14.046: D/dalvikvm(141): GC_EXPLICIT freed 2038K, 24% free 18162K/23687K, paused 7ms+19ms
06-04 14:41:14.275: I/Launcher(141): setLoadOnResume
06-04 14:41:15.685: D/dalvikvm(141): GC_CONCURRENT freed 1880K, 23% free 18301K/23687K, paused 12ms+23ms
06-04 14:41:17.347: D/dalvikvm(80): GC_EXPLICIT freed 286K, 19% free 14521K/17735K, paused 9ms+289ms
06-04 14:41:17.506: I/installd(35): unlink /data/dalvik-cache/data@app@imag.imo.isithombe-2.apk@classes.dex
06-04 14:41:17.530: D/AndroidRuntime(9655): Shutting down VM
06-04 14:41:17.575: I/AndroidRuntime(9655): NOTE: attach of thread 'Binder Thread #3' failed
06-04 14:41:17.597: D/dalvikvm(9655): GC_CONCURRENT freed 100K, 84% free 337K/2048K, paused 2ms+2ms
06-04 14:41:17.597: D/jdwp(9655): Got wake-up signal, bailing out of select
06-04 14:41:17.597: D/dalvikvm(9655): Debugger has detached; object registry had 1 entries
06-04 14:41:19.105: D/AndroidRuntime(9669): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
06-04 14:41:19.105: D/AndroidRuntime(9669): CheckJNI is ON
06-04 14:41:20.986: D/AndroidRuntime(9669): Calling main entry com.android.commands.am.Am
06-04 14:41:21.116: I/ActivityManager(80): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=imag.imo.isithombe/.ImagggggggActivity } from pid 9669
06-04 14:41:21.198: W/WindowManager(80): Failure taking screenshot for (230x143) to layer 21035
06-04 14:41:21.376: D/AndroidRuntime(9669): Shutting down VM
06-04 14:41:21.439: I/AndroidRuntime(9669): NOTE: attach of thread 'Binder Thread #3' failed
06-04 14:41:21.476: I/ActivityManager(80): Start proc imag.imo.isithombe for activity imag.imo.isithombe/.ImagggggggActivity: pid=9679 uid=10045 gids={}
06-04 14:41:21.496: D/dalvikvm(9669): GC_CONCURRENT freed 98K, 83% free 358K/2048K, paused 1ms+1ms
06-04 14:41:21.540: D/jdwp(9669): Got wake-up signal, bailing out of select
06-04 14:41:21.540: D/dalvikvm(9669): Debugger has detached; object registry had 1 entries
06-04 14:41:24.316: V/TLINE(9679): new: android.text.TextLine@406538d0
06-04 14:41:25.286: V/TLINE(9679): new: android.text.TextLine@406584d8
06-04 14:41:25.357: I/ActivityManager(80): Displayed imag.imo.isithombe/.ImagggggggActivity: +4s16ms
06-04 14:41:27.316: D/dalvikvm(324): GC_EXPLICIT freed 19K, 6% free 6324K/6663K, paused 6ms+825ms
06-04 14:41:27.326: W/IInputConnectionWrapper(4295): showStatusIcon on inactive InputConnection
06-04 14:41:28.440: I/ActivityManager(80): Starting: Intent { act=android.intent.action.CHOOSER cmp=android/com.android.internal.app.ChooserActivity (has extras) } from pid 9679
06-04 14:41:28.445: W/WindowManager(80): Failure taking screenshot for (230x143) to layer 21040
06-04 14:41:28.795: I/ActivityManager(80): Starting: Intent { act=android.intent.action.GET_CONTENT typ=image/* flg=0x3000000 cmp=com.android.gallery/com.android.camera.ImageGallery } from pid 9679
06-04 14:41:28.946: I/ActivityManager(80): Start proc com.android.gallery for activity com.android.gallery/com.android.camera.ImageGallery: pid=9687 uid=10016 gids={1015, 1024, 1006, 2001, 3003}
06-04 14:41:30.685: D/AndroidRuntime(9687): Shutting down VM
06-04 14:41:30.685: W/dalvikvm(9687): threadid=1: thread exiting with uncaught exception (group=0x40014760)
06-04 14:41:30.746: E/AndroidRuntime(9687): FATAL EXCEPTION: main
06-04 14:41:30.746: E/AndroidRuntime(9687): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.gallery/com.android.camera.ImageGallery}: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.ActivityThread.access$1500(ActivityThread.java:122)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.os.Looper.loop(Looper.java:132)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.ActivityThread.main(ActivityThread.java:4025)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at java.lang.reflect.Method.invokeNative(Native Method)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at java.lang.reflect.Method.invoke(Method.java:491)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at dalvik.system.NativeStart.main(Native Method)
06-04 14:41:30.746: E/AndroidRuntime(9687): Caused by: android.util.AndroidRuntimeException: You cannot combine custom titles with other title features
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:204)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2339)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2546)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:219)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.Activity.setContentView(Activity.java:1780)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at com.android.camera.ImageGallery.onCreate(ImageGallery.java:113)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
06-04 14:41:30.746: E/AndroidRuntime(9687):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
06-04 14:41:30.746: E/AndroidRuntime(9687):     ... 11 more
06-04 14:41:30.775: W/ActivityManager(80):   Force finishing activity com.android.gallery/com.android.camera.ImageGallery
06-04 14:41:30.845: W/WindowManager(80): Failure taking screenshot for (230x143) to layer 21045
06-04 14:41:31.355: W/ActivityManager(80): Activity pause timeout for ActivityRecord{409d6360 com.android.gallery/com.android.camera.ImageGallery}
06-04 14:41:34.515: I/Process(9687): Sending signal. PID: 9687 SIG: 9
06-04 14:41:34.565: I/ActivityManager(80): Process com.android.gallery (pid 9687) has died.
06-04 14:41:35.175: W/InputManagerService(80): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41028698
06-04 14:41:38.836: D/dalvikvm(402): GC_EXPLICIT freed 11K, 5% free 6237K/6531K, paused 9ms+4ms
4

1 に答える 1

0

原因:android.util.AndroidRuntimeException:カスタムタイトルを他のタイトル機能と組み合わせることはできません

私はあなたが使用したかもしれないとは思わない

<item name="android:windowNoTitle">true</item>

もしそうならそれを削除します。

于 2012-06-11T12:21:47.687 に答える