socialauth android ResourceNotFound - android

I am implementing socialAuth android in my application. But when i click my share button there is a error:
01-07 19:25:27.308: D/SocialAuthAdapter(4167): Selected provider is facebook
01-07 19:25:27.308: D/SocialAuthAdapter(4167): Loading keys and secrets from configuration
01-07 19:25:27.328: I/SocialAuthConfig(4167): Loading application configuration
01-07 19:25:27.358: I/OAuth2(4167): Determining URL for redirection
01-07 19:25:27.358: I/OAuth2(4167): Redirection to following URL should happen : https://graph.facebook.com/oauth/authorize?client_id=447809015285714&response_type=code&redirect_uri=fbconnect%3A%2F%2Fsuccess&scope=publish_stream,email,user_birthday,user_location
01-07 19:25:27.358: D/SocialAuthAdapter(4167): Loading URL : https://graph.facebook.com/oauth/authorize?client_id=447809015285714&response_type=code&redirect_uri=fbconnect%3A%2F%2Fsuccess&scope=publish_stream,email,user_birthday,user_location&type=user_agent&display=touch
01-07 19:25:27.358: D/SocialAuthAdapter(4167): Callback URI : fbconnect://success
01-07 19:25:27.368: W/ResourceType(4167): No package identifier when getting value for resource number 0x00000000
01-07 19:25:27.368: D/AndroidRuntime(4167): Shutting down VM
01-07 19:25:27.378: W/dalvikvm(4167): threadid=1: thread exiting with uncaught exception (group=0x40a9c210)
01-07 19:25:27.378: E/AndroidRuntime(4167): FATAL EXCEPTION: main
01-07 19:25:27.378: E/AndroidRuntime(4167): android.content.res.Resources$NotFoundException: Resource ID #0x0
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.content.res.Resources.getValue(Resources.java:1023)
More log.
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.content.res.Resources.getDrawable(Resources.java:668)
01-07 19:25:27.378: E/AndroidRuntime(4167): at org.brickred.socialauth.android.SocialAuthDialog.setUpTitle(SocialAuthDialog.java:149)
01-07 19:25:27.378: E/AndroidRuntime(4167): at org.brickred.socialauth.android.SocialAuthDialog.onCreate(SocialAuthDialog.java:123)
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.app.Dialog.dispatchOnCreate(Dialog.java:353)
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.app.Dialog.show(Dialog.java:257)
01-07 19:25:27.378: E/AndroidRuntime(4167): at org.brickred.socialauth.android.SocialAuthAdapter$3$1.run(SocialAuthAdapter.java:372)
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.os.Handler.handleCallback(Handler.java:605)
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.os.Handler.dispatchMessage(Handler.java:92)
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.os.Looper.loop(Looper.java:137)
01-07 19:25:27.378: E/AndroidRuntime(4167): at android.app.ActivityThread.main(ActivityThread.java:4441)
01-07 19:25:27.378: E/AndroidRuntime(4167): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 19:25:27.378: E/AndroidRuntime(4167): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 19:25:27.378: E/AndroidRuntime(4167): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
01-07 19:25:27.378: E/AndroidRuntime(4167): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
01-07 19:25:27.378: E/AndroidRuntime(4167): at dalvik.system.NativeStart.main(Native Method)
And i have no idea why is that happening.
I have followed very carefully after examples.

Please put Icon for facebook,Google, twitter with name facebook.png,foursquare.png,google.png,linkedin.png,myspace.png,twitter.png,yahoo.png int res folder.

Just put on your Image (facebook.png , linkedin.png , twitter.png or many more who your integrate with your app) drawable folder.
This problem occur because on your lib file require icon and if its not here on your package then its shows error.
No package identifier when getting value for resource number 0x00000000
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getDrawable(Resources.java:668)
at org.brickred.socialauth.android.SocialAuthDialog.setUpTitle(SocialAuthDialog.java:149)
above i m just shown u main error which occur when file is not here on your drawable.

Related

Posting text on a facebook page from an android app

I'm working on an android app which integrates with facebook(I'm very new).I could successfully implement the login/logout part.
Now I need my android app to post(text) on a specific page.I'm not sure how to approach this. I tried reading all the similar posts. I used "facebook.request(page_id+/feed , parameters , "POST")" ,this always returned a null pointer exception maybe because the request(feed,parameters,"POST") method is deprecated (code written below).
I tried to follow the facebook sdk tutorial which involved access_tokens and graph apis which further confused me.
I don't even know how to approach this anymore.Please, if someone could guide me it would be a lot helpful and easier for me to go about this.
Thank you.
try{
Tring response = facebook.request("me");
Bundle parameters = new Bundle();
parameters.putString("message", msg);
parameters.putString("description", "test test test");
// parameters.putByteArray("message", msg);
response = facebook.request("me/feed", parameters, "POST");
Log.d("Tests", "got response: " + response);
if (response == null || response.equals("")
|| response.equals("false")) {
Log.v("Error", "Blank response");
}else{
}
} catch (Exception e) {
e.printStackTrace();
}
}
LOGCAT
01-07 20:14:21.330 7830-7835/com.example.kai.gameofapis2 D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
01-07 20:16:21.460 11583-11583/com.example.kai.gameofapis2 V/Zygote﹕ Switching descriptor 33 to /dev/null
01-07 20:16:21.460 11583-11583/com.example.kai.gameofapis2 V/Zygote﹕ Switching descriptor 9 to /dev/null
01-07 20:16:21.470 11583-11583/com.example.kai.gameofapis2 D/dalvikvm﹕ Late-enabling CheckJNI
01-07 20:16:21.710 11583-11583/com.example.kai.gameofapis2 D/ActivityThread﹕ handleBindApplication:com.example.kai.gameofapis2
01-07 20:16:21.720 11583-11583/com.example.kai.gameofapis2 D/ActivityThread﹕ setTargetHeapUtilization:0.75
01-07 20:16:21.720 11583-11583/com.example.kai.gameofapis2 D/ActivityThread﹕ setTargetHeapMinFree:524288
01-07 20:16:22.301 11583-11583/com.example.kai.gameofapis2 I/MainFragment﹕ Logged in...
01-07 20:16:22.471 11583-11583/com.example.kai.gameofapis2 D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so
01-07 20:16:22.701 11583-11583/com.example.kai.gameofapis2 D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so
01-07 20:16:22.701 11583-11583/com.example.kai.gameofapis2 D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so
01-07 20:16:22.831 11583-11583/com.example.kai.gameofapis2 D/OpenGLRenderer﹕ Enabling debug mode 0
01-07 20:16:22.831 11583-11583/com.example.kai.gameofapis2 I/MainFragment﹕ Logged in...
01-07 20:16:22.951 11583-11583/com.example.kai.gameofapis2 I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy#41d82b18 time:64292484
01-07 20:16:30.539 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ java.lang.NullPointerException
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at com.example.kai.gameofapis2.MainFragment$2.onClick(MainFragment.java:75)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at android.view.View.performClick(View.java:4438)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at android.view.View$PerformClick.run(View.java:18439)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:733)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:95)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at android.os.Looper.loop(Looper.java:136)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5153)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
01-07 20:16:30.549 11583-11583/com.example.kai.gameofapis2 W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)

android crash exception with no root point

What can I do when I get an Exception but can't understand where to looking for
I mean I know it's in my NewHomeTabActivity, but where should I start searching. I try to insert some logs line and break point but still can't resolve the root cause
01-07 13:39:33.133: W/dalvikvm(12350): threadid=1: thread exiting with uncaught exception (group=0x40c471f8)
01-07 13:39:33.133: W/System.err(12350): java.lang.IllegalStateException: Could not find a method onTabClicked(View) in the activity class att.uc.ui.screen.NewHomeTabActivity for onClick handler on view class android.widget.RelativeLayout with id 'tab_dialer'
01-07 13:39:33.138: W/System.err(12350): at android.view.View$1.onClick(View.java:3085)
01-07 13:39:33.143: W/System.err(12350): at android.view.View.performClick(View.java:3620)
01-07 13:39:33.143: W/System.err(12350): at android.view.View$PerformClick.run(View.java:14292)
01-07 13:39:33.143: W/System.err(12350): at android.os.Handler.handleCallback(Handler.java:605)
01-07 13:39:33.148: W/System.err(12350): at android.os.Handler.dispatchMessage(Handler.java:92)
01-07 13:39:33.148: W/System.err(12350): at android.os.Looper.loop(Looper.java:137)
01-07 13:39:33.148: W/System.err(12350): at android.app.ActivityThread.main(ActivityThread.java:4507)
01-07 13:39:33.153: W/System.err(12350): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 13:39:33.153: W/System.err(12350): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 13:39:33.153: W/System.err(12350): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
01-07 13:39:33.158: W/System.err(12350): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
01-07 13:39:33.158: W/System.err(12350): at dalvik.system.NativeStart.main(Native Method)
01-07 13:39:33.158: W/System.err(12350): Caused by: java.lang.NoSuchMethodException: onTabClicked [class android.view.View]
01-07 13:39:33.163: W/System.err(12350): at java.lang.Class.getConstructorOrMethod(Class.java:460)
01-07 13:39:33.163: W/System.err(12350): at java.lang.Class.getMethod(Class.java:915)
01-07 13:39:33.168: W/System.err(12350): at android.view.View$1.onClick(View.java:3078)
01-07 13:39:33.173: W/System.err(12350): ... 11 more
Read the stactrace from bottom to up line by line to get the relevant message.
It crashes because it cannot find the method onTabClicked(View) in your activity.
I'm assuming that you have an XML control which is given the onClick property, something like this:
android:onClick="onTabClicked"
If so, then your activity should have a method called onTabClicked(View view) that accepts a parameter of type View, this is mandatory.
Like this:
public void onTabClicked(View view){
}
The log suggest it is a RunTimeException so you cannot find it by putting logs ,
the onTabClicked method you have used (maybe defined in xml file ) is not found at RunTime ,
this could be because you have called a higher sdk version while building against lower sdk version , you can either target higher sdk version or use alternative approach for onclick
similar link can suggest a possible solution Android TabWidget detect click on current tab

java.lang.illegalStateException during performing Search using Android Search Configration

I am trying to implement search in my android app. I have followed the step as suggested by the tutorials to make search possible. I have implemented search with a button.As soon as I press the button,not always but sometimes my Logcat show this error and application stops.This doesnot happen always but sometimes,I dont know why this happening as if this is an issue than the error should showup always when I click the search button.
01-07 13:32:54.759: E/AndroidRuntime(11826): FATAL EXCEPTION: main
01-07 13:32:54.759: E/AndroidRuntime(11826): java.lang.IllegalStateException: Could not execute method of the activity
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View$1.onClick(View.java:3050)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View.performClick(View.java:3517)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View$PerformClick.run(View.java:14155)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.os.Handler.handleCallback(Handler.java:605)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.os.Handler.dispatchMessage(Handler.java:92)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.os.Looper.loop(Looper.java:137)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.ActivityThread.main(ActivityThread.java:4508)
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 13:32:54.759: E/AndroidRuntime(11826): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
01-07 13:32:54.759: E/AndroidRuntime(11826): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
01-07 13:32:54.759: E/AndroidRuntime(11826): at dalvik.system.NativeStart.main(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): Caused by: java.lang.reflect.InvocationTargetException
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): at java.lang.reflect.Method.invoke(Method.java:511)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.view.View$1.onClick(View.java:3045)
01-07 13:32:54.759: E/AndroidRuntime(11826): ... 11 more
01-07 13:32:54.759: E/AndroidRuntime(11826): Caused by: java.lang.OutOfMemoryError
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.nativeCreate(Native Method)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.createBitmap(Bitmap.java:551)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:543)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:518)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:370)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.content.res.Resources.loadDrawable(Resources.java:1935)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.content.res.Resources.getDrawable(Resources.java:664)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:580)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:140)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.ApplicationPackageManager.getApplicationIcon(ApplicationPackageManager.java:637)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.updateSearchAppIcon(SearchDialog.java:438)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.updateUI(SearchDialog.java:391)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.show(SearchDialog.java:278)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.doShow(SearchDialog.java:230)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchDialog.show(SearchDialog.java:212)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchManager.startSearch(SearchManager.java:526)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.SearchManager.startSearch(SearchManager.java:503)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.Activity.startSearch(Activity.java:3055)
01-07 13:32:54.759: E/AndroidRuntime(11826): at android.app.Activity.onSearchRequested(Activity.java:3018)
01-07 13:32:54.759: E/AndroidRuntime(11826): at com.vahzay.android.smstrove.ListMessages.onsearchClick(ListMessages.java:150)
01-07 13:32:54.759: E/AndroidRuntime(11826): ... 14 more
Here is the snippet that cause this error
public void onsearchClick(View v) {
if (v.getId() == R.id.searcher) {
Log.i("search has been clicked", "show");
// this method is used to call the search activity from the
// listmessages activity no intent is used as its need a special
// functionality
onSearchRequested(); // line no 150
}
}
This crash happened due to Out of Memory Exception as given in your log. The search icon is not being loaded properly. For using Bitmaps efficiently take a look at this.

SMSManager for chinese, Nullpointer

I'm trying to send a sms with chinese characters using SMSManager. It works fine for english and german, but unfortunately not for chinese.
My Log:
01-07 20:23:56.200: W/System.err(15742): java.lang.NullPointerException
01-07 20:23:56.200: W/System.err(15742): at android.os.Parcel.readException(Parcel.java:1266)
01-07 20:23:56.204: W/System.err(15742): at android.os.Parcel.readException(Parcel.java:1248)
01-07 20:23:56.204: W/System.err(15742): at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:561)
01-07 20:23:56.204: W/System.err(15742): at android.telephony.SmsManager.sendTextMessage(SmsManager.java:109)
01-07 20:23:56.204: W/System.err(15742): at com.app.myapp.MainActivity.sendSms(MainActivity.java:158)
01-07 20:23:56.204: W/System.err(15742): at com.app.myapp.MainActivity.buttonClick(MainActivity.java:103)
01-07 20:23:56.204: W/System.err(15742): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 20:23:56.204: W/System.err(15742): at java.lang.reflect.Method.invoke(Method.java:521)
01-07 20:23:56.204: W/System.err(15742): at android.view.View$1.onClick(View.java:2067)
01-07 20:23:56.204: W/System.err(15742): at android.view.View.performClick(View.java:2408)
01-07 20:23:56.204: W/System.err(15742): at android.view.View$PerformClick.run(View.java:8818)
01-07 20:23:56.204: W/System.err(15742): at android.os.Handler.handleCallback(Handler.java:587)
01-07 20:23:56.204: W/System.err(15742): at android.os.Handler.dispatchMessage(Handler.java:92)
01-07 20:23:56.204: W/System.err(15742): at android.os.Looper.loop(Looper.java:123)
01-07 20:23:56.204: W/System.err(15742): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-07 20:23:56.208: W/System.err(15742): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 20:23:56.208: W/System.err(15742): at java.lang.reflect.Method.invoke(Method.java:521)
01-07 20:23:56.208: W/System.err(15742): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
01-07 20:23:56.208: W/System.err(15742): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
01-07 20:23:56.208: W/System.err(15742): at dalvik.system.NativeStart.main(Native Method)
And this is how I send the SMS
SmsManager smsManager = SmsManager.getDefault();
for (int i = 0; i < numbers.size(); i++) {
smsManager.sendTextMessage(numbers.get(i), null,
message, null, null);
}
Any ideas? Thanks in advance.
I had the same problem, I could solved it just limiting the number of characters. In English, 160 characters are allowed. In Chinese, only 70 characters can be used (each character takes more bytes to be represented).
So, to test it, just replace message with message.substring(0, 69) and it will work.
To properly solve the proble, splitted messages must be sent, check:
http://www.programering.com/a/MTM4EjMwATE.html

NPE when drawing TabWidget in android (only on HTC Magic?)

I've received report from the user of an app I've written that he gets FC whenever starting a certain activity. I have not been able to reproduce the issue on the emulator or on my HTC Hero (running 1.5), but this user running HTC Magic (with 1.6) is facing this error every time.
What bothers me is that no single step in the stacktrace actually includes any code in my app (com.filmtipset)
01-07 00:10:26.773 I/ActivityManager( 141): Starting activity: Intent { cmp=com.filmtipset/.ViewMovie (has extras) }
01-07 00:10:27.023 D/AndroidRuntime( 2402): Shutting down VM
01-07 00:10:27.023 W/dalvikvm( 2402): threadid=3: thread exiting with uncaught exception (group=0x4001e170)
01-07 00:10:27.023 E/AndroidRuntime( 2402): Uncaught handler: thread main exiting due to uncaught exception
01-07 00:10:27.083 E/AndroidRuntime( 2402): java.lang.NullPointerException
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.widget.TabWidget.dispatchDraw(TabWidget.java:173)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.View.draw(View.java:6552)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.widget.FrameLayout.draw(FrameLayout.java:352)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.View.draw(View.java:6552)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.widget.FrameLayout.draw(FrameLayout.java:352)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1883)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewRoot.draw(ViewRoot.java:1332)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewRoot.performTraversals(ViewRoot.java:1097)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.view.ViewRoot.handleMessage(ViewRoot.java:1613)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.os.Handler.dispatchMessage(Handler.java:99)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.os.Looper.loop(Looper.java:123)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at android.app.ActivityThread.main(ActivityThread.java:4320)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at java.lang.reflect.Method.invokeNative(Native Method)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at java.lang.reflect.Method.invoke(Method.java:521)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
01-07 00:10:27.083 E/AndroidRuntime( 2402): at dalvik.system.NativeStart.main(Native Method)
Full dump here if I've missed anything of interest
I'm guessing, then, that there might be something wrong with my layout. It's quite verbose, so I'm posting it here, rather than pasting the whole thing on SO.
There is a tabwidget, where one tab is connected to the scrollview, svFilmInfo, and one to the linear layout llComments.
The tab host is populated as such:
Drawable commentSelector = getResources().getDrawable(R.drawable.tabcomment);
Drawable infoSelector = getResources().getDrawable(R.drawable.tabinfo);
mTabHost = getTabHost();
mTabHost.getTabWidget().setBackgroundColor(Color.BLACK);
mTabHost.addTab(mTabHost.newTabSpec("tabInfo").setIndicator("Filminfo", infoSelector).setContent(R.id.svFilmInfo));
mTabHost.addTab(mTabHost.newTabSpec("tabInfo").setIndicator("Kommentarer", commentSelector).setContent(R.id.llComments));
Since I cannot reproduce the error myself, and since I cannot find any mention in the stack trace of what might be causing the error, I don't quite know where to start troubleshooting this.
I'd appreciate any pointers.
I run into stack traces like that when people have a TabHost in their layout but do not add TabSpecs to it. You show the code where you add tabs -- are you sure that is being called in all circumstances?
I got the same error in my application, but only on Android 1.6 and higher - it worked on 1.5.
The reason: initial application Activity extended TabActivity but layout XML with TabHost widget was not loaded via setContentView() in onCreate() scope (it was scheduled to load via Runnable a little bit later).
Then first try to actually draw such not-fully-processed TabActivity on screen caused crash with NullPointerException at android.widget.TabWidget.dispatchDraw(TabWidget.java:173)
You have to load XML or instantiate TabHost and fill with newTabSpecs programatically before onCreate ends.

Categories

Resources