Fragment can not be cast to android.support.v4.app.Fragment - android

I am getting this error while implementing Fragment tabhost.
I am basically trying to call an activity in tab view which extends Fragment.
I also tried with extending FragmentActivity, but it gives an error on "onCreateView" method.
Upon removing #override annotation from "onCreateView" method, and running the app lead to following error.
11-27 20:54:06.937: E/AndroidRuntime(4255): FATAL EXCEPTION: main
11-27 20:54:06.937: E/AndroidRuntime(4255): java.lang.ClassCastException: com.variouscal.calculators.FragmentTab1 cannot be cast to android.support.v4.app.Fragment
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.support.v4.app.Fragment.instantiate(Fragment.java:394)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.support.v4.app.FragmentTabHost.doTabChanged(FragmentTabHost.java:339)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.support.v4.app.FragmentTabHost.onTabChanged(FragmentTabHost.java:307)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.widget.TabHost.invokeOnTabChangeListener(TabHost.java:391)
11-27 20:54:06.937: E/AndroidRuntime
(4255): at android.widget.TabHost.setCurrentTab(TabHost.java:376)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:150)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:546)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.view.View.performClick(View.java:4084)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.view.View$PerformClick.run(View.java:16966)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.os.Handler.handleCallback(Handler.java:615)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.os.Handler.dispatchMessage(Handler.java:92)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.os.Looper.loop(Looper.java:137)
11-27 20:54:06.937: E/AndroidRuntime(4255): at android.app.ActivityThread.main(ActivityThread.java:4931)
11-27 20:54:06.937: E/AndroidRuntime(4255): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 20:54:06.937: E/AndroidRuntime(4255): at java.lang.reflect.Method.invoke(Method.java:511)
11-27 20:54:06.937: E/AndroidRuntime(4255): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
11-27 20:54:06.937: E/AndroidRuntime(4255): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
11-27 20:54:06.937: E/AndroidRuntime(4255): at dalvik.system.NativeStart.main(Native Method)

The problem is that there are two versions of Fragment:
android.app.Fragment
android.support.v4.app.Fragment
Be sure to import the correct one and be consistent.

Without code this is more of a guess but it sounds like your are trying to use android.app.Fragment with android.support.v4.app.Fragment which you cannot do

Related

Google has stopped error dialog when using SpeechRecogniser Api

I am using Speech Recogniser in my app. If I am trying ok google and at the same time launching my app for speech recognition, then performing these steps repeatedly causing crash of google app. I am getting this an error dialog saying "Google has stopped" and log exception as :
FATAL EXCEPTION: LocalEngine0
11-27 17:33:21.801 E/AndroidRuntime( 4490): Process: com.google.android.googlequicksearchbox:search, PID: 4490
11-27 17:33:21.801 E/AndroidRuntime( 4490): java.lang.RuntimeException: Unchecked exception running task: ThreadChanger: a.a(w, b, c)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.android.apps.gsa.shared.util.concurrent.a.ba.setException(SourceFile:20)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.android.apps.gsa.shared.util.concurrent.a.ae.run(SourceFile:11)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.lang.Thread.run(Thread.java:761)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:6)
11-27 17:33:21.801 E/AndroidRuntime( 4490): Caused by: java.lang.IllegalStateException
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.common.base.Preconditions.checkState(SourceFile:33)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.android.apps.gsa.speech.e.c.b.a(SourceFile:103)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.android.apps.gsa.staticplugins.recognizer.c.a.a(SourceFile:31)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.lang.reflect.Method.invoke(Native Method)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at com.google.android.apps.gsa.shared.util.bn.run(SourceFile:9)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
11-27 17:33:21.801 E/AndroidRuntime( 4490): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-27 17:33:21.801 E/AndroidRuntime( 4490): ... 5 more
11-27 17:33:21.805 W/ActivityManager( 3327): Force finishing activity com.google.android.googlequicksearchbox/com.google.android.apps.gsa.lockscreenentry.LockscreenEntryActivity
How can i overcome this error.
To prevent false positives, hotword detection is disabled when a spoken feedback service is enabled.
add android:accessibilityFeedbackType="feedbackAllMask"
configure the service using an XML file
<accessibility-service
android:accessibilityEventTypes="typeViewClicked|typeViewFocused"
android:packageNames="com.example.android.myFirstApp,com.example.android.mySecondApp"
android:accessibilityFeedbackType="feedbackAllMask"
android:notificationTimeout="100"
android:settingsActivity="com.example.android.apis.accessibility.TestBackActivity"
android:canRetrieveWindowContent="true"/>
You can also refer these link one,two
Hope it will to you!!

Application loading slow and how to use strict mode in android

I am facing lots of message through strict mode in logcat. May be this reason if i click next buttton on ui, then it takes long time almost 1 min. How to occure this, data loading process is fast. but why got strict mode log? i don't know.
and finally, how to use strict mode in my 4.1.6 . what is the meaning of DEVELOPER_MODE. , StrictMode details ,
sample of logcat:
11-27 13:08:14.220: D/StrictMode(11010): StrictMode policy violation; ~duration=1492 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=23 violation=2
11-27 13:08:14.220: D/StrictMode(11010): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1135)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnection.applyBlockGuardPolicy(SQLiteConnection.java:1041)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:595)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnection.setForeignKeyModeFromConfiguration(SQLiteConnection.java:281)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:214)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
11-27 13:08:14.220: D/StrictMode(11010): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:952)
11-27 13:08:14.220: D/StrictMode(11010): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:256)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
11-27 13:08:14.220: D/StrictMode(11010): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
11-27 13:08:14.220: D/StrictMode(11010): at com.project.dc.databases.DBAdapter.open(DBAdapter.java:224)
11-27 13:08:14.220: D/StrictMode(11010): at com.project.dc.activity.RunFormActivity.saveOnSwipe(RunFormActivity.java:10641)
11-27 13:08:14.220: D/StrictMode(11010): at com.project.dc.activity.RunFormActivity$34.onClick(RunFormActivity.java:2575)
11-27 13:08:14.220: D/StrictMode(11010): at android.view.View.performClick(View.java:4438)
11-27 13:08:14.220: D/StrictMode(11010): at android.view.View$PerformClick.run(View.java:18422)
11-27 13:08:14.220: D/StrictMode(11010): at android.os.Handler.handleCallback(Handler.java:733)
11-27 13:08:14.220: D/StrictMode(11010): at android.os.Handler.dispatchMessage(Handler.java:95)
11-27 13:08:14.220: D/StrictMode(11010): at android.os.Looper.loop(Looper.java:136)
11-27 13:08:14.220: D/StrictMode(11010): at android.app.ActivityThread.main(ActivityThread.java:5001)
11-27 13:08:14.220: D/StrictMode(11010): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 13:08:14.220: D/StrictMode(11010): at java.lang.reflect.Method.invoke(Method.java:515)
11-27 13:08:14.220: D/StrictMode(11010): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-27 13:08:14.220: D/StrictMode(11010): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-27 13:08:14.220: D/StrictMode(11010): at dalvik.system.NativeStart.main(Native Method)
i have getting following strict mode(logcat): http://pastebin.com/jeDa0YNA
I have depress this by taking this problem: please could you give some idea how to fix this.
Your application is performing database operations on main Thread. So you are getting this error.
Move the saveonswipe call in OnClick to an AsyncTask

how to do Implementation of Android TvView

I have started working on Android Smart Tv. I have to make a TvView, I Know Leanback is only library which gives us a lot of stuff to work with Android Smart Tv. Last day i have tried to work with TvView to perform streaming of channels. I have included android-support-Leanback17 . but still i am getting error That no class definition found. Any Help will be appreciated . i Just want to know that which library support this TvView.
Thanks in Advance
This is my LogCat
11-27 09:25:10.684: E/AndroidRuntime(16203): FATAL EXCEPTION: main
11-27 09:25:10.684: E/AndroidRuntime(16203): java.lang.NoClassDefFoundError: android.media.tv.TvView
11-27 09:25:10.684: E/AndroidRuntime(16203): at com.example.tvtest.MainActivity.onCreate(MainActivity.java:25)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.Activity.performCreate(Activity.java:5104)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.ActivityThread.access$600(ActivityThread.java:141)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.os.Looper.loop(Looper.java:137)
11-27 09:25:10.684: E/AndroidRuntime(16203): at android.app.ActivityThread.main(ActivityThread.java:5041)
11-27 09:25:10.684: E/AndroidRuntime(16203): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 09:25:10.684: E/AndroidRuntime(16203): at java.lang.reflect.Method.invoke(Method.java:511)
11-27 09:25:10.684: E/AndroidRuntime(16203): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
11-27 09:25:10.684: E/AndroidRuntime(16203): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:596)
11-27 09:25:10.684: E/AndroidRuntime(16203): at dalvik.system.NativeStart.main(Native Method)
I'm assuming you want to allow users to watch content and if so, you will not actually implement a TVView. Google provides the 'Live Channels' app which will display channels provided via the TVInputFramework. This app is hidden until an app implementing the TVInputFramework is installed.
Google has now released a sample app implementing the TVInputFramework which will publish channels that can be watched in the Live Channels app.
Documentation outlining the TVInputFramework:
http://developer.android.com/training/tv/tif/index.html
I hope this will at least point you in the right direction even if it doesn't directly answer your question.
I would suggest everyone to go for this Google sample or implementation for Android TvView:
https://android.googlesource.com/platform/packages/apps/TV/
It is possible to add TVVIEw component to your application like this
> <android.media.tv.TvView
> android:id="#+id/dtv_view"
> android:layout_width="match_parent"
> android:layout_height="match_parent"
> android:visibility="visible" />
And it is possible to tune to particular channgel using below code
String channelUrl="content://android.media.tv/channel/"+channelNumber;
mTvView.tune(mInputId, Uri.parse(channelUrl));
input id is available in TV database(refering to which source channel is coming from).
If you pass these info to tvview it will start playing.

app runs on one device but not another

FIXED
For some reason the special menu i created was killing it... THere was no API's or anything in that class. But thanks for the support guys
So this really isnt a question about a code but a very random error...
My app runs perfectly on my Nexus S rooted, but when it runs on any other phone or the emulator it will instantly FC.
The app does have root permissions but only if you choose to use it. Otherwise it is just a normal application.
Does anyone have a solution to why it would run on one device but not another?
-EDIT-
11-27 17:28:37.734: E/AndroidRuntime(7104): FATAL EXCEPTION: main
11-27 17:28:37.734: E/AndroidRuntime(7104): java.lang.VerifyError: com.SyndicateApps.OmegaLauncher.Launcher
11-27 17:28:37.734: E/AndroidRuntime(7104): at java.lang.Class.newInstanceImpl(Native Method)
11-27 17:28:37.734: E/AndroidRuntime(7104): at java.lang.Class.newInstance(Class.java:1429)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.app.Instrumentation.newActivity(Instrumentation.java:1056)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2752)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2859)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.app.ActivityThread.access$2300(ActivityThread.java:136)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2179)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.os.Looper.loop(Looper.java:143)
11-27 17:28:37.734: E/AndroidRuntime(7104): at android.app.ActivityThread.main(ActivityThread.java:5073)
11-27 17:28:37.734: E/AndroidRuntime(7104): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 17:28:37.734: E/AndroidRuntime(7104): at java.lang.reflect.Method.invoke(Method.java:521)
11-27 17:28:37.734: E/AndroidRuntime(7104): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
11-27 17:28:37.734: E/AndroidRuntime(7104): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-27 17:28:37.734: E/AndroidRuntime(7104): at dalvik.system.NativeStart.main(Native Method)
EDIT 2 -
So its on 2.2 but same problem... Is there a way i can find the class using the api level 9?
LOGCAT 2 (on android 2.2)
EDIT 2 / SECOND LOGCAT ON 2.2 EMULATOR -
11-27 18:56:12.159: E/AndroidRuntime(258): FATAL EXCEPTION: main
11-27 18:56:12.159: E/AndroidRuntime(258): java.lang.VerifyError: com.SyndicateApps.OmegaLauncher.Launcher
11-27 18:56:12.159: E/AndroidRuntime(258): at java.lang.Class.newInstanceImpl(Native Method)
11-27 18:56:12.159: E/AndroidRuntime(258): at java.lang.Class.newInstance(Class.java:1429)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.os.Looper.loop(Looper.java:123)
11-27 18:56:12.159: E/AndroidRuntime(258): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-27 18:56:12.159: E/AndroidRuntime(258): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 18:56:12.159: E/AndroidRuntime(258): at java.lang.reflect.Method.invoke(Method.java:521)
11-27 18:56:12.159: E/AndroidRuntime(258): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-27 18:56:12.159: E/AndroidRuntime(258): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-27 18:56:12.159: E/AndroidRuntime(258): at dalvik.system.NativeStart.main(Native Method)
A lot of the errors are when it comes to this... --> (new DialogInterface.OnShowListener()
java.lang.VerifyError typically means you're using a class or method that's not available on the current Java VM. Which Android version is on Nexus and which is on the other device? Android app manifest system allows for compiling against, say, API level 10 while allowing running against API level 6. There will be no warning against using backwards-incompatible classes until you run.
EDIT: So apparently the class com.SyndicateApps.OmegaLauncher.Launcher uses some API that was introduced in level 9. In the project properties, under "Android", set build target (temporarily) to Android 2.2 and see where the errors occur.
EDIT2: if the static analysis fails, try commenting out method insides in the class, method by method, until it loads. VerifyError is fairly easy to debug that way - it's triggered by very existence of faulty code in the class, not by its invokation. It's not like you have to do 100% coverage analysis.

how to solve this issue"The content of the adapter has changed but ListView did not receive a notification"?

11-27 13:24:08.203: ERROR/AndroidRuntime(556): Uncaught handler: thread main exiting due to uncaught exception
11-27 13:24:08.628: ERROR/AndroidRuntime(556): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131165233, class android.widget.ListView) with Adapter(class com.bluepal.android.iConcierge.CustomAdapter)]
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.ListView.layoutChildren(ListView.java:1432)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.AbsListView.onLayout(AbsListView.java:1113)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1108)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.TableRow.onLayout(TableRow.java:121)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.TableLayout.onLayout(TableLayout.java:437)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.View.layout(View.java:6830)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.ViewRoot.performTraversals(ViewRoot.java:996)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.os.Handler.dispatchMessage(Handler.java:99)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.os.Looper.loop(Looper.java:123)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at android.app.ActivityThread.main(ActivityThread.java:4363)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at java.lang.reflect.Method.invokeNative(Native Method)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at java.lang.reflect.Method.invoke(Method.java:521)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
11-27 13:24:08.628: ERROR/AndroidRuntime(556): at dalvik.system.NativeStart.main(Native Method)
As I can't still comment I'll put it as an answer, though it might now solve your problem.
I had the same issue when showing images in a listview that were downloaded in an asynchronous thread and it happened the same when clicking in an item (and by so opening other activity) and immediately pressing the back, thus returning to the ListActivity.
So what I made to (apparently) solve the issue was to hide the list when stopping the activity and showing the list again when going back to it.
#Override
protected void onStop() {
super.onStop();
getListView().setVisibility(View.GONE);
}
#Override
protected void onRestart() {
super.onRestart();
getListView().setVisibility(View.VISIBLE);
}
Quite simple, huh?
Hope it helps you.

Categories

Resources