I am writing a Class that gets the File's in a folder, and displays the contents in a list view. the application force closes when i run this activity... I Debugged for a while, and searched through logcat, and I cannot find the problem...
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;
}
ANY help would be greatly appreciated...
Logcat Data:
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)
The log says that:
You have to add <uses-permission android:name="android.permission.WAKE_LOCK"/> to your AndroidManifest.xml !
Oh some lines further down there is an other error in the log:
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?
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?
Have you declared it in your Manifest?
Related
I have developed an android application using Titanium sdk 3.5.1.The modules used in application are:
LocationServiceModele and PushSubscription module.
The problem is that ,in some devices the application continously crashes and restart the application.The error shows in DDms is:
application log
07-13 17:49:54.598: E/TiApplication(11402): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1194)
07-13 17:49:54.598: E/TiApplication(11402): at android.app.Activity.performStart(Activity.java:5258)
07-13 17:49:54.598: E/TiApplication(11402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2171)
07-13 17:49:54.598: E/TiApplication(11402): ... 11 more
07-13 17:49:54.639: E/AndroidRuntime(11402): FATAL EXCEPTION: main
07-13 17:49:54.639: E/AndroidRuntime(11402): Process: com.qatartips, PID: 11402
07-13 17:49:54.639: E/AndroidRuntime(11402): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.qatartips/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198)
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.app.ActivityThread.access$800(ActivityThread.java:139)
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.os.Handler.dispatchMessage(Handler.java:102)
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.os.Looper.loop(Looper.java:136)
07-13 17:49:54.639: E/AndroidRuntime(11402): at android.app.ActivityThread.main(ActivityThread.java:5086)
07-13 17:49:54.639: E/AndroidRuntime(11402): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 17:49:54.639: E/AndroidRuntime(11402): at java.lang.reflect.Method.invoke(Method.java:515)
07-13 17:49:54.639: E/AndroidRuntime(11402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-13 17:49:54.639: E/AndroidRuntime(11402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-13 17:49:54.639: E/AndroidRuntime(11402): at dalvik.system.NativeStart.main(Native Method)
07-13 17:49:54.639: E/AndroidRuntime(11402): Caused by: java.lang.NullPointerException
07-13 17:49:54.639: E/AndroidRuntime(11402): at com.android.internal.policy.impl.PhoneWindow.updateProgressBars(PhoneWindow.java:1367)
07-13 17:49:54.639: E/AndroidRuntime(11402): at com.android.internal.policy.impl.PhoneWindow.onIntChanged(PhoneWindow.java:1322)
07-13 17:49:54.639: E/AndroidRuntime(11402): at com.android.internal.policy.impl.PhoneWindow.updateInt(PhoneWindow.java:3341)
07-13 17:49:54.639: E/AndroidRuntime(11402): at com.android.internal.policy.impl.PhoneWindow.setFeatureInt(PhoneWindow.java:1267)
I re-installed the entire SDK along w/ Eclipse, but no dice. I am absolutely clueless as to how to debug this. I should note that it works fine on my partner's machine, but he uses a 4.1.2 ROM on his phone. Here is the error log: http://pastebin.com/yx2XT8qE
07-13 16:45:23.581: W/dalvikvm(12926): Unable to resolve superclass of Lcom/ahhaproductions/SMSapp/SMSapp; (42)
07-13 16:45:23.581: W/dalvikvm(12926): Link of class 'Lcom/ahhaproductions/SMSapp/SMSapp;' failed
07-13 16:45:23.581: D/AndroidRuntime(12926): Shutting down VM
07-13 16:45:23.581: W/dalvikvm(12926): threadid=1: thread exiting with uncaught exception (group=0x40b6b930)
07-13 16:45:23.591: I/Process(12926): Sending signal. PID: 12926 SIG: 9
07-13 16:45:23.591: E/AndroidRuntime(12926): FATAL EXCEPTION: main
07-13 16:45:23.591: E/AndroidRuntime(12926): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ahhaproductions.SMSapp/com.ahhaproductions.SMSapp.SMSapp}: java.lang.ClassNotFoundException: Didn't find class "com.ahhaproductions.SMSapp.SMSapp" on path: /mnt/asec/com.ahhaproductions.SMSapp-2/pkg.apk
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2224)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.ActivityThread.access$600(ActivityThread.java:153)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.os.Looper.loop(Looper.java:137)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.ActivityThread.main(ActivityThread.java:5227)
07-13 16:45:23.591: E/AndroidRuntime(12926): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 16:45:23.591: E/AndroidRuntime(12926): at java.lang.reflect.Method.invoke(Method.java:511)
07-13 16:45:23.591: E/AndroidRuntime(12926): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
07-13 16:45:23.591: E/AndroidRuntime(12926): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
07-13 16:45:23.591: E/AndroidRuntime(12926): at dalvik.system.NativeStart.main(Native Method)
07-13 16:45:23.591: E/AndroidRuntime(12926): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ahhaproductions.SMSapp.SMSapp" on path: /mnt/asec/com.ahhaproductions.SMSapp-2/pkg.apk
07-13 16:45:23.591: E/AndroidRuntime(12926): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-13 16:45:23.591: E/AndroidRuntime(12926): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-13 16:45:23.591: E/AndroidRuntime(12926): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
07-13 16:45:23.591: E/AndroidRuntime(12926): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215)
07-13 16:45:23.591: E/AndroidRuntime(12926): ... 11 more
This seems insightful: Android java.lang.RuntimeException: Unable to instantiate activity ComponentInfo
I decided to right-click the project > Build Path > Configure Build Path
And here I changed the order:
Original Order:
SMSApp/src,
SMSApp/gen,
Android 4.2.2,
Android Private Libraries,
Android Dependencies
Fixed Order:
Android Private Libraries,
SMSApp/src,
SMSApp/gen,
Android 4.2.2,
Android Dependencies
Make sure to check all the ones w/ dependencies (or all of them)
I then cleaned the project as usual and ran it and it worked.
EDIT: Apparently the ordering doesn't matter according to Dpa99c's comment below and the link here.
I only started on the android application today so I haven't added any jars. I am currently using sdk and adt r19 if it helps.
How the android manifest looks like
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".LoginActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".UserHome"></activity>
</application>
How it happened:
btnLogin.setOnClickListener(new OnClickListener(){
public void onClick(View arg0){
Intent mapIntent = new Intent(LoginActivity.this, UserHome.class);
LoginActivity.this.startActivity(mapIntent);
Log.i("Intent", "Login to UserHome");
}
});
I am clueless to why this is happening.
Edit
Error log
07-13 06:14:06.844: E/AndroidRuntime(442): FATAL EXCEPTION: main
07-13 06:14:06.844: E/AndroidRuntime(442): java.lang.NoClassDefFoundError: com.srd.application.UserHome
07-13 06:14:06.844: E/AndroidRuntime(442): at com.srd.application.LoginActivity$1.onClick(LoginActivity.java:70)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.View.performClick(View.java:2408)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.View.onKeyUp(View.java:4121)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.widget.TextView.onKeyUp(TextView.java:4431)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.KeyEvent.dispatch(KeyEvent.java:1061)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.View.dispatchKeyEvent(View.java:3740)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:788)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1667)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1102)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.app.Activity.dispatchKeyEvent(Activity.java:2063)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1643)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2471)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2441)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.os.Looper.loop(Looper.java:123)
07-13 06:14:06.844: E/AndroidRuntime(442): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-13 06:14:06.844: E/AndroidRuntime(442): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 06:14:06.844: E/AndroidRuntime(442): at java.lang.reflect.Method.invoke(Method.java:521)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-13 06:14:06.844: E/AndroidRuntime(442): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-13 06:14:06.844: E/AndroidRuntime(442): at dalvik.system.NativeStart.main(Native Method)
Did you defined use-library tag in your application's manifest file?
<uses-library android:name="com.google.android.maps" />
like,
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<uses-library android:name="com.google.android.maps" />
.
.
.
</application>
Also check for your application contains Google-api not Android.
I am using the android compatibility package to use Loaders . when i init a loader or restart it in the onCreate method , it just wroks find but when i restart or init it in the onStart it throw an error , what I want know why " some times " when I initLoader in the onCreate of the activity and click some button that move me quickly to another activity before the loader bind the data to the UI ,and return back to the activity that previously init the Loader the loader doesnot load the data "nothing appears on the UI ?!!!! so i thought that move the initLoader to onStart but it throw an error
07-13 03:19:15.140: E/AndroidRuntime(23179): java.lang.RuntimeException: Unable to resume activity {biz.dot.khtmeh/biz.dot.khtmeh.ui.HomeScreen}: java.lang.IllegalStateException: There is already a listener registered
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2444)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2472)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1173)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.os.Looper.loop(Looper.java:137)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-13 03:19:15.140: E/AndroidRuntime(23179): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 03:19:15.140: E/AndroidRuntime(23179): at java.lang.reflect.Method.invoke(Method.java:511)
07-13 03:19:15.140: E/AndroidRuntime(23179): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-13 03:19:15.140: E/AndroidRuntime(23179): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-13 03:19:15.140: E/AndroidRuntime(23179): at dalvik.system.NativeStart.main(Native Method)
07-13 03:19:15.140: E/AndroidRuntime(23179): Caused by: java.lang.IllegalStateException: There is already a listener registered
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.support.v4.content.Loader.registerListener(Loader.java:130)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.support.v4.app.LoaderManagerImpl$LoaderInfo.start(LoaderManager.java:259)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.support.v4.app.LoaderManagerImpl.installLoader(LoaderManager.java:509)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.support.v4.app.LoaderManagerImpl.createAndInstallLoader(LoaderManager.java:496)
07-13 03:19:15.140: E/AndroidRuntime(23179): at android.support.v4.app.LoaderManagerImpl.restartLoader(LoaderManager.java:642)
It is likely you are re-using a loader more than once. Each time onCreateLoader(..) is called, you should be returning a new instance of a Loader<T>.
Hey i'm trying to use ViewAnimator and i probably am missing something basic.
This is what i have :
va = new ViewAnimator(this);
va.setInAnimation(inFromLeftAnimation());
va.setOutAnimation(outToRightAnimation());
RelativeLayout stage = (RelativeLayout)findViewById(R.layout.american_stage);
va.addView(stage,0);
setContentView(va);
Where inFromLeftAnimation and outToRightAnimation just handles animations and works perfectly.
And ofcourse that the file really exists...
I Get this log :
07-13 15:45:14.515: E/AndroidRuntime(564): java.lang.RuntimeException: Unable to start activity ComponentInfo{shibby.webhunt/shibby.webhunt.ArcadeModeActivity}: java.lang.NullPointerException
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.os.Looper.loop(Looper.java:123)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-13 15:45:14.515: E/AndroidRuntime(564): at java.lang.reflect.Method.invokeNative(Native Method)
07-13 15:45:14.515: E/AndroidRuntime(564): at java.lang.reflect.Method.invoke(Method.java:521)
07-13 15:45:14.515: E/AndroidRuntime(564): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-13 15:45:14.515: E/AndroidRuntime(564): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-13 15:45:14.515: E/AndroidRuntime(564): at dalvik.system.NativeStart.main(Native Method)
07-13 15:45:14.515: E/AndroidRuntime(564): Caused by: java.lang.NullPointerException
07-13 15:45:14.515: E/AndroidRuntime(564): at android.view.ViewGroup.addView(ViewGroup.java:1815)
07-13 15:45:14.515: E/AndroidRuntime(564): at shibby.webhunt.ArcadeModeActivity.onCreate(ArcadeModeActivity.java:25)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-13 15:45:14.515: E/AndroidRuntime(564): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
And i have no idea why.
Is it impossible to use XML files as views? do i have to build the views myself?
07-13 15:45:14.515: E/AndroidRuntime(564): Caused by: java.lang.NullPointerException
07-13 15:45:14.515: E/AndroidRuntime(564): at android.view.ViewGroup.addView(ViewGroup.java:1815)
It looks like you are trying to add a View (RelativeLayout stage) that is null, I don't believe you can load a layout with findViewById():
findViewById(R.layout.american_stage);
If you are trying to open a non-visible layout in american_stage.xml, use a LayoutInflater:
LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
stage = layoutInflater.inflate(R.layout.american_stage, null);
Or if you are trying to load an already visible RelativeLayout:
1) Give the RelativeLayout the id american_stage
<RelativeLayout
android:id="#+id/american_stage"
...
2) And use:
findViewById(R.id.american_stage);