suddenly my android application crashes - android

Sorry guys for the newbie questions. I'm new to android, was working to set some login system in new application. Everything worked fine (after a long while), i had a login button from the menu in the main page which was just an empty "hello world" default activity. Then I decided to remove the "hello world" text view, i tried to run it immediately and the application crashed with null exception. I was doing ctrl+z like crazy but the application keeps on crashing.
i understand absolutely nothing from the LogCat:
10-24 00:10:17.982: I/ActivityManager(59): Starting activity: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
flg=0x10200000
cmp=com.application.mySoSpecialApplication/.MainActivity } 10-24
00:10:18.002: W/WindowManager(59): HistoryRecord{4505f618
com.application.mySoSpecialApplication/.MainActivity} failed creating
starting window 10-24 00:10:18.002: W/WindowManager(59):
java.lang.RuntimeException: Binary XML file line #25: You must supply
a layout_height attribute. 10-24 00:10:18.002: W/WindowManager(59):
at
android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
10-24 00:10:18.002: W/WindowManager(59): at
android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3593)
10-24 00:10:18.002: W/WindowManager(59): at
android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:3672)
10-24 00:10:18.002: W/WindowManager(59): at
android.widget.LinearLayout$LayoutParams.(LinearLayout.java:1395)
10-24 00:10:18.002: W/WindowManager(59): at
android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1321)
10-24 00:10:18.002: W/WindowManager(59): at
android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45)
10-24 00:10:18.002: W/WindowManager(59): at
android.view.LayoutInflater.rInflate(LayoutInflater.java:620) 10-24
00:10:18.002: W/WindowManager(59): at
android.view.LayoutInflater.inflate(LayoutInflater.java:407) 10-24
00:10:18.002: W/WindowManager(59): at
android.view.LayoutInflater.inflate(LayoutInflater.java:320) 10-24
00:10:18.002: W/WindowManager(59): at
android.view.LayoutInflater.inflate(LayoutInflater.java:276) 10-24
00:10:18.002: W/WindowManager(59): at
com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2165)
10-24 00:10:18.002: W/WindowManager(59): at
com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2220)
10-24 00:10:18.002: W/WindowManager(59): at
com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1407)
10-24 00:10:18.002: W/WindowManager(59): at
com.android.internal.policy.impl.PhoneWindowManager.addStartingWindow(PhoneWindowManager.java:894)
10-24 00:10:18.002: W/WindowManager(59): at
com.android.server.WindowManagerService$H.handleMessage(WindowManagerService.java:9007)
10-24 00:10:18.002: W/WindowManager(59): at
android.os.Handler.dispatchMessage(Handler.java:99) 10-24
00:10:18.002: W/WindowManager(59): at
android.os.Looper.loop(Looper.java:123) 10-24 00:10:18.002:
W/WindowManager(59): at
com.android.server.WindowManagerService$WMThread.run(WindowManagerService.java:570)
10-24 00:10:18.042: I/ActivityManager(59): Start proc
com.application.mySoSpecialApplication for activity
com.application.mySoSpecialApplication/.MainActivity: pid=463
uid=10036 gids={3003} 10-24 00:10:18.272: D/AndroidRuntime(463):
Shutting down VM 10-24 00:10:18.272: W/dalvikvm(463): threadid=1:
thread exiting with uncaught exception (group=0x4001d800) 10-24
00:10:18.292: E/AndroidRuntime(463): FATAL EXCEPTION: main 10-24
00:10:18.292: E/AndroidRuntime(463): java.lang.RuntimeException:
Unable to instantiate application
com.application.mySoSpecialApplication.mySoSpecialApplicationApplication:
java.lang.NullPointerException 10-24 00:10:18.292:
E/AndroidRuntime(463): at
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:649)
10-24 00:10:18.292: E/AndroidRuntime(463): at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232)
10-24 00:10:18.292: E/AndroidRuntime(463): at
android.app.ActivityThread.access$3000(ActivityThread.java:125) 10-24
00:10:18.292: E/AndroidRuntime(463): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
10-24 00:10:18.292: E/AndroidRuntime(463): at
android.os.Handler.dispatchMessage(Handler.java:99) 10-24
00:10:18.292: E/AndroidRuntime(463): at
android.os.Looper.loop(Looper.java:123) 10-24 00:10:18.292:
E/AndroidRuntime(463): at
android.app.ActivityThread.main(ActivityThread.java:4627) 10-24
00:10:18.292: E/AndroidRuntime(463): at
java.lang.reflect.Method.invokeNative(Native Method) 10-24
00:10:18.292: E/AndroidRuntime(463): at
java.lang.reflect.Method.invoke(Method.java:521) 10-24 00:10:18.292:
E/AndroidRuntime(463): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
10-24 00:10:18.292: E/AndroidRuntime(463): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 10-24
00:10:18.292: E/AndroidRuntime(463): at
dalvik.system.NativeStart.main(Native Method) 10-24 00:10:18.292:
E/AndroidRuntime(463): Caused by: java.lang.NullPointerException 10-24
00:10:18.292: E/AndroidRuntime(463): at
android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90)
10-24 00:10:18.292: E/AndroidRuntime(463): at
com.application.mySoSpecialApplication.mySoSpecialApplicationApplication.(mySoSpecialApplicationApplication.java:14)
10-24 00:10:18.292: E/AndroidRuntime(463): at
java.lang.Class.newInstanceImpl(Native Method) 10-24 00:10:18.292:
E/AndroidRuntime(463): at
java.lang.Class.newInstance(Class.java:1429) 10-24 00:10:18.292:
E/AndroidRuntime(463): at
android.app.Instrumentation.newApplication(Instrumentation.java:957)
10-24 00:10:18.292: E/AndroidRuntime(463): at
android.app.Instrumentation.newApplication(Instrumentation.java:942)
10-24 00:10:18.292: E/AndroidRuntime(463): at
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:644)
10-24 00:10:18.292: E/AndroidRuntime(463): ... 11 more 10-24
00:10:18.312: W/ActivityManager(59): Force finishing activity
com.application.mySoSpecialApplication/.MainActivity 10-24
00:10:18.968: W/ActivityManager(59): Activity pause timeout for
HistoryRecord{4505f618
com.application.mySoSpecialApplication/.MainActivity} 10-24
00:10:21.322: I/Process(463): Sending signal. PID: 463 SIG: 9 10-24
00:10:21.352: I/ActivityManager(59): Process
com.application.mySoSpecialApplication (pid 463) has died. 10-24
00:10:21.383: W/InputManagerService(59): Window already focused,
ignoring focus gain of:
com.android.internal.view.IInputMethodClient$Stub$Proxy#44fc1780 10-24
00:10:29.087: W/ActivityManager(59): Activity destroy timeout for
HistoryRecord{4505f618
com.application.mySoSpecialApplication/.MainActivity}
Maybe one of you guys will figure out where is the problem. Thank you very much.

here is something interesting:
W/WindowManager(59): java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_height attribute. 1
you must specify layout_height in your layout views, its mandatory

I guess you're missing an atribute you should have defined to some View.
So, to the XML layout inflated (the one you inflate when setConentView(R.layout.this_one) somewhere on the onCreate() method, I guess) just check if is missing the android:layout_height="wrap_content". If so, please add it. This should resolve you issue.
Binary XML file line #25: You must supply a layout_height attribute.

Incase of runtime error, look for word Caused by: in your logcat.
This will help you to locate error easily.
Here in your case- look at logCat below...
00:10:18.292: E/AndroidRuntime(463): Caused by: java.lang.NullPointerException
10-24 00:10:18.292: E/AndroidRuntime(463): at android.content.ContextWrapper.getContentResolver(ContextWrapper.java:90)
10-24 00:10:18.292: E/AndroidRuntime(463): at com.application.mySoSpecialApplication.mySoSpecialApplicationApplication.(mySoSpecialApplicationApplication.java:14)
Ypu will find that run time error caused by getContentResolver at line 14 of (mySoSpecialApplicationApplication.java:14)
So here you located the error successfully.
After that look at the explanation by yugidroid
This will help you.
I guess you're missing an atribute you should have defined to some View.
So, to the XML layout inflated (the one you inflate when setConentView(R.layout.this_one) somewhere on the onCreate() method, I guess) just check if is missing the android:layout_height="wrap_content". If so, please add it. This should resolve you issue.
Binary XML file line #25: You must supply a layout_height attribute.

Related

resuming activity nullpointer exception

I have an activity that has a view pager and loads it's images from a JSON ( and so, several fragments ).
When I do some kind of external activity like start a phonecall or see a website ( via my aplication ), when this activity resumes it gives me a null pointer exception.
10-24 19:36:56.626: E/AndroidRuntime(18567): FATAL EXCEPTION: main
10-24 19:36:56.626: E/AndroidRuntime(18567): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.imagefromurl/com.example.imagefromurl.MainActivity}: java.lang.NullPointerException
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2373)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2425)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.ActivityThread.access$600(ActivityThread.java:162)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.os.Handler.dispatchMessage(Handler.java:107)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.os.Looper.loop(Looper.java:194)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.ActivityThread.main(ActivityThread.java:5422)
10-24 19:36:56.626: E/AndroidRuntime(18567): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 19:36:56.626: E/AndroidRuntime(18567): at java.lang.reflect.Method.invoke(Method.java:525)
10-24 19:36:56.626: E/AndroidRuntime(18567): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837)
10-24 19:36:56.626: E/AndroidRuntime(18567): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
10-24 19:36:56.626: E/AndroidRuntime(18567): at dalvik.system.NativeStart.main(Native Method)
10-24 19:36:56.626: E/AndroidRuntime(18567): Caused by: java.lang.NullPointerException
10-24 19:36:56.626: E/AndroidRuntime(18567): at com.example.imagefromurl.FragmentOne.onCreateView(FragmentOne.java:28)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1504)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1103)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1901)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:567)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.Activity.performStart(Activity.java:5132)
10-24 19:36:56.626: E/AndroidRuntime(18567): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2346)
10-24 19:36:56.626: E/AndroidRuntime(18567): ... 11 more
Is the any way that I can solve this?
Line 28: sUrl = activity.urlProfile.toString();
translation - on main activity I run the AsynkTask and I get this string sUrl . then on the fragment I cast the activity and get the string ( probably you would figure that by yourselves but it doesnt hurt to describe it all )
Either the fragment has lost the instance of that activity, so the field activity is null.
Or the the field inside the activity urlProfile is null.
Or you casted your activity into a wrong activity, usually you get the activity with getActivity() or you catch that from the parameters.
But the main problem is, that you try to call toString() on a null which causes the exception. Try to catch it with
if(activity != null && activity.urlProfile != null) {
sUrl = activity.urlProfile.toString();
} else {
// do something different when those objects are null
}

Force close in android app landscape mode - Null pointer exception

My app works good in portrait mode. when i use landscape mode and perform any activity it gets force close. The log says null pointer exception. I verified with the source all the information is passing good but getting force close.
Log:
10-24 17:14:38.566: E/AndroidRuntime(3684): FATAL EXCEPTION: main
10-24 17:14:38.566: E/AndroidRuntime(3684): java.lang.RuntimeException: Unable to start activity ComponentInfo{/app.UserPage}: java.lang.NullPointerException
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.access$600(ActivityThread.java:162)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.os.Handler.dispatchMessage(Handler.java:107)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.os.Looper.loop(Looper.java:194)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.main(ActivityThread.java:5371)
10-24 17:14:38.566: E/AndroidRuntime(3684): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 17:14:38.566: E/AndroidRuntime(3684): at java.lang.reflect.Method.invoke(Method.java:525)
10-24 17:14:38.566: E/AndroidRuntime(3684): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
10-24 17:14:38.566: E/AndroidRuntime(3684): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
10-24 17:14:38.566: E/AndroidRuntime(3684): at dalvik.system.NativeStart.main(Native Method)
10-24 17:14:38.566: E/AndroidRuntime(3684): Caused by: java.lang.NullPointerException
10-24 17:14:38.566: E/AndroidRuntime(3684): at app.UserPage.onCreate(UserPage.java:219)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.Activity.performCreate(Activity.java:5122)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081)
10-24 17:14:38.566: E/AndroidRuntime(3684): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
10-24 17:14:38.566: E/AndroidRuntime(3684): ... 11 more

Android: runtime-error 'Unable to create directory', on use of class DownloadManager, method setDestinationInExternalPublicDir

I'm getting this exception:
10-24 17:08:19.711: E/AndroidRuntime(1379): FATAL EXCEPTION: main
10-24 17:08:19.711: E/AndroidRuntime(1379): java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.campusfqm.cfqm/br.com.campusfqm.cfqm.DownloadManagerActivity}: java.lang.IllegalStateException: Unable to create directory: /mnt/sdcard/Download
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.os.Looper.loop(Looper.java:126)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.ActivityThread.main(ActivityThread.java:3997)
10-24 17:08:19.711: E/AndroidRuntime(1379): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 17:08:19.711: E/AndroidRuntime(1379): at java.lang.reflect.Method.invoke(Method.java:491)
10-24 17:08:19.711: E/AndroidRuntime(1379): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
10-24 17:08:19.711: E/AndroidRuntime(1379): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
10-24 17:08:19.711: E/AndroidRuntime(1379): at dalvik.system.NativeStart.main(Native Method)
10-24 17:08:19.711: E/AndroidRuntime(1379): Caused by: java.lang.IllegalStateException: Unable to create directory: /mnt/sdcard/Download
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.DownloadManager$Request.setDestinationInExternalPublicDir(DownloadManager.java:466)
10-24 17:08:19.711: E/AndroidRuntime(1379): at br.com.campusfqm.cfqm.DownloadManagerActivity.download(DownloadManagerActivity.java:51)
10-24 17:08:19.711: E/AndroidRuntime(1379): at br.com.campusfqm.cfqm.DownloadManagerActivity.onCreate(DownloadManagerActivity.java:43)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
10-24 17:08:19.711: E/AndroidRuntime(1379): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
10-24 17:08:19.711: E/AndroidRuntime(1379): ... 11 more
Using the class DownloadManager, with this code:
DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://centraldemangas.com.br/forum/dbtech/vbshop/images/gifts/pidgey.gif"));
request.setAllowedNetworkTypes(Request.NETWORK_MOBILE | Request.NETWORK_WIFI);
request.setAllowedOverRoaming(false);
request.setTitle("pidgey.gif");
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"pid.gif");
id = downloadManager.enqueue(request);
The exception is pointing to request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,"pid.gif");
The problem is in
Unable to create directory: /mnt/sdcard/Download
Try this:
String name = Environment.getExternalStorageDirectory().getAbsolutePath();
name += "/YourDirectoryName/" ;
Do you have the proper permissions in your Manifest ?
See WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions
I think you didn't give a sd card size when you crated the emulator.

how to launch android application Manager

Does anyone know the package name for Application Manager on android. I have a method that i want to allow the user to go directly from my app to the application manager:
public void goToApplicationManager(){
Intent startMain = this.getPackageManager().getLaunchIntentForPackage("com.android.settings.ManageApplications");
startActivity(startMain);
}
but that throws an error.. i can just do com.android.settings, and it will take the user to settings but i would like to take them specifically to the application manager. do i have the wrong package name?
my error:
10-24 13:36:43.748: E/AndroidRuntime(31133): FATAL EXCEPTION: main
10-24 13:36:43.748: E/AndroidRuntime(31133): java.lang.NullPointerException
10-24 13:36:43.748: E/AndroidRuntime(31133): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1382)
10-24 13:36:43.748: E/AndroidRuntime(31133): at android.app.Activity.startActivityForResult(Activity.java:3190)
10-24 13:36:43.748: E/AndroidRuntime(31133): at android.app.Activity.startActivity(Activity.java:3297)
10-24 13:36:43.748: E/AndroidRuntime(31133): at com.eliddell.services_test.ServiceLauncher.goToApplicationManager(ServiceLauncher.java:101)
10-24 13:36:43.748: E/AndroidRuntime(31133): at com.eliddell.services_test.ServiceLauncher$4.onClick(ServiceLauncher.java:156)
10-24 13:36:43.748: E/AndroidRuntime(31133): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:168)
10-24 13:36:43.748: E/AndroidRuntime(31133): at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 13:36:43.748: E/AndroidRuntime(31133): at android.os.Looper.loop(Looper.java:137)
10-24 13:36:43.748: E/AndroidRuntime(31133): at android.app.ActivityThread.main(ActivityThread.java:4514)
10-24 13:36:43.748: E/AndroidRuntime(31133): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 13:36:43.748: E/AndroidRuntime(31133): at java.lang.reflect.Method.invoke(Method.java:511)
10-24 13:36:43.748: E/AndroidRuntime(31133): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
10-24 13:36:43.748: E/AndroidRuntime(31133): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
10-24 13:36:43.748: E/AndroidRuntime(31133): at dalvik.system.NativeStart.main(Native Method)
startActivity(
new Intent(android.provider.Settings.ACTION_APPLICATION_SETTINGS), 0);
Have you looked at ACTION_MANAGE_APPLICATIONS_SETTINGS or ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS?

Android: Recource$NotFoundException

Im working with android, and am releatively new to it, Ive got an exception I cant seem to fix.
Logcat output
10-24 13:50:59.941: E/AndroidRuntime(772): FATAL EXCEPTION: main
10-24 13:50:59.941: E/AndroidRuntime(772): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.metronome/com.metronome.MainActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x78
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1955)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.ActivityThread.access$600(ActivityThread.java:122)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.os.Looper.loop(Looper.java:137)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.ActivityThread.main(ActivityThread.java:4340)
10-24 13:50:59.941: E/AndroidRuntime(772): at java.lang.reflect.Method.invokeNative(Native Method)
10-24 13:50:59.941: E/AndroidRuntime(772): at java.lang.reflect.Method.invoke(Method.java:511)
10-24 13:50:59.941: E/AndroidRuntime(772): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-24 13:50:59.941: E/AndroidRuntime(772): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-24 13:50:59.941: E/AndroidRuntime(772): at dalvik.system.NativeStart.main(Native Method)
10-24 13:50:59.941: E/AndroidRuntime(772): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x78
10-24 13:50:59.941: E/AndroidRuntime(772): at android.content.res.Resources.getText(Resources.java:247)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.widget.TextView.setText(TextView.java:3432)
10-24 13:50:59.941: E/AndroidRuntime(772): at com.metronome.MainActivity.onCreate(MainActivity.java:36)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.Activity.performCreate(Activity.java:4465)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
10-24 13:50:59.941: E/AndroidRuntime(772): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
10-24 13:50:59.941: E/AndroidRuntime(772): ... 11 more
Ive read that people say to fix the problem by cleaning the project but I have tried that twice and it didnt help. I also creted another project and copied the code, so I think it is something different. Any help is appreciated.
Line 36
txtBPM1.setText(120, TextView.BufferType.EDITABLE);
This error occurs when you access some controls or which is not present in your layout you pass on onCreate in you activity setContentView(R.layout.your_layout);. Just checkout all the id's , string's and other controls which you are using belongs to same layout or not
change 120 to be a string like so :
txtBPM1.setText(""+120, TextView.BufferType.EDITABLE);
(your error in MainActivity.java:line 36 (it is import generated R))
1.delete error line from import and use pop-up message on red R.id.**
2. close and reopen IDE

Categories

Resources