2011-07-13 20 views
-1

私は、Fileをフォルダに入れてリストビューで内容を表示するクラスを作成しています。アプリケーションの力は、私はこの活動を実行すると...私はListView強制終了

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    File root = new File(Environment.getExternalStorageDirectory(), "Notes"); 
    if(!root.exists()){ 
     root.mkdirs(); 
    } 
    setListAdapter(new ArrayAdapter<String>(this, R.layout.folders, buildDirArray(root))); 

     ListView lv = getListView(); 
     lv.setTextFilterEnabled(true); 

     lv.setOnItemClickListener(new OnItemClickListener() { 
     public void onItemClick(AdapterView<?> parent, View view, 
      int position, long id) { 
      // When clicked, show a toast with the TextView text 
      Toast.makeText(getApplicationContext(), ((TextView) view).getText(), 
       Toast.LENGTH_SHORT).show(); 
     } 
     }); 
    } 
public String[] buildDirArray(File dir){ 
int temp = dir.list().length; 
String[] tm = dir.list(); 
String[] tmp = new String[temp]; 
for(int i=1;i==dir.list().length;i++){ 
    tmp[i]=tm[i]; 
} 

    return tmp; 

} 

任意の助けをいただければ幸いです...しばらくデバッグされ、logcatを通じて検索し、私は問題を見つけることができない閉じ... Logcatデータ:

07-13 20:41:21.205: ERROR/Zygote(32): setreuid() failed. errno: 2 
07-13 20:41:29.045: ERROR/Zygote(32): setreuid() failed. errno: 17 
07-13 20:41:30.345: ERROR/BatteryService(58): usbOnlinePath not found 
07-13 20:41:30.345: ERROR/BatteryService(58): batteryVoltagePath not found 
07-13 20:41:30.345: ERROR/BatteryService(58): batteryTemperaturePath not found 
07-13 20:41:30.364: ERROR/SurfaceFlinger(58): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake 
07-13 20:41:36.015: ERROR/EventHub(58): could not get driver version for /dev/input/mouse0, Not a typewriter 
07-13 20:41:36.015: ERROR/EventHub(58): could not get driver version for /dev/input/mice, Not a typewriter 
07-13 20:41:36.295: ERROR/System(58): Failure starting core service 
07-13 20:41:36.295: ERROR/System(58): java.lang.SecurityException 
07-13 20:41:36.295: ERROR/System(58):  at android.os.BinderProxy.transact(Native Method) 
07-13 20:41:36.295: ERROR/System(58):  at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146) 
07-13 20:41:36.295: ERROR/System(58):  at android.os.ServiceManager.addService(ServiceManager.java:72) 
07-13 20:41:36.295: ERROR/System(58):  at com.android.server.ServerThread.run(SystemServer.java:184) 
07-13 20:41:37.315: ERROR/SoundPool(58): error loading /system/media/audio/ui/Effect_Tick.ogg 
07-13 20:41:37.325: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressStandard.ogg 
07-13 20:41:37.325: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressSpacebar.ogg 
07-13 20:41:37.346: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressDelete.ogg 
07-13 20:41:37.356: ERROR/SoundPool(58): error loading /system/media/audio/ui/KeypressReturn.ogg 
07-13 20:41:40.414: ERROR/ThrottleService(58): Could not open GPS configuration file /etc/gps.conf 
07-13 20:41:42.795: ERROR/logwrapper(147): executing /system/bin/tc failed: No such file or directory 
07-13 20:41:42.945: ERROR/logwrapper(148): executing /system/bin/tc failed: No such file or directory 
07-13 20:41:43.065: ERROR/logwrapper(149): executing /system/bin/tc failed: No such file or directory 
07-13 20:41:54.824: ERROR/HierarchicalStateMachine(58): TetherMaster - unhandledMessage: msg.what=3 
07-13 20:43:11.984: ERROR/AndEngine(282): You have to add 
07-13 20:43:11.984: ERROR/AndEngine(282):  <uses-permission android:name="android.permission.WAKE_LOCK"/> 
07-13 20:43:11.984: ERROR/AndEngine(282): to your AndroidManifest.xml ! 
07-13 20:43:11.984: ERROR/AndEngine(282): java.lang.SecurityException: Neither user 10033 nor current process has android.permission.WAKE_LOCK. 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.os.Parcel.readException(Parcel.java:1247) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.os.Parcel.readException(Parcel.java:1235) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.os.IPowerManager$Stub$Proxy.acquireWakeLock(IPowerManager.java:236) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.os.PowerManager$WakeLock.acquire(PowerManager.java:250) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at org.anddev.andengine.ui.activity.BaseGameActivity.acquireWakeLock(BaseGameActivity.java:202) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at org.anddev.andengine.ui.activity.BaseGameActivity.doResume(BaseGameActivity.java:165) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at org.anddev.andengine.ui.activity.BaseGameActivity.onWindowFocusChanged(BaseGameActivity.java:82) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at com.android.internal.policy.impl.PhoneWindow$DecorView.onWindowFocusChanged(PhoneWindow.java:1981) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.view.View.dispatchWindowFocusChanged(View.java:3788) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:658) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1921) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.os.Handler.dispatchMessage(Handler.java:99) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.os.Looper.loop(Looper.java:123) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at android.app.ActivityThread.main(ActivityThread.java:4627) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at java.lang.reflect.Method.invokeNative(Native Method) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at java.lang.reflect.Method.invoke(Method.java:521) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
07-13 20:43:11.984: ERROR/AndEngine(282):  at dalvik.system.NativeStart.main(Native Method) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282): FATAL EXCEPTION: main 
07-13 20:43:20.614: ERROR/AndroidRuntime(282): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.momentum.xpad/com.momentum.xpad.folders}; have you declared this activity in your AndroidManifest.xml? 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.app.Activity.startActivityForResult(Activity.java:2817) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.app.Activity.startActivity(Activity.java:2923) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.momentum.xpad.main.onOptionsItemSelected(main.java:69) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.app.Activity.onMenuItemSelected(Activity.java:2195) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:730) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:532) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.view.View$PerformClick.run(View.java:8816) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.os.Handler.handleCallback(Handler.java:587) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.os.Handler.dispatchMessage(Handler.java:92) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.os.Looper.loop(Looper.java:123) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at android.app.ActivityThread.main(ActivityThread.java:4627) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at java.lang.reflect.Method.invokeNative(Native Method) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at java.lang.reflect.Method.invoke(Method.java:521) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
07-13 20:43:20.614: ERROR/AndroidRuntime(282):  at dalvik.system.NativeStart.main(Native Method) 
+0

logCatの結果のスクリーンショットを提供できますか? – iTurki

+0

LogCatの出力は素晴らしいでしょう。 –

+0

LogCatをもう一度再確認してください。 「ログ」タブを読むと、すべてのログが表示され、アプリケーションFCが読み込まれたときにクラッシュログがスタックトレースとして表示されます。その情報は、あなたの問題を追跡するのに非常に役立ちます。 – pakerfeldt

答えて

3

ログが言うこと:

You have to add <uses-permission android:name="android.permission.WAKE_LOCK"/> to your AndroidManifest.xml ! 

ログで他のエラーがあるダウン、さらにいくつかの行ああ:

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.momentum.xpad/com.momentum.xpad.folders}; have you declared this activity in your AndroidManifest.xml? 
+0

動作しませんでした... –

+0

エラーは変更されましたか?もしそうなら、あなたは新しいエラーを投稿できますか? –

0

android.content.ActivityNotFoundException:明示的なアクティビティクラス{com.momentum.xpad/com.momentum.xpad.folders}を見つけることができません。あなたのAndroidManifest.xmlでこのアクティビティを宣言しましたか?

マニフェストで宣言しましたか?

関連する問題