Error inflating layout - Error inflating class fragment - android

I'm trying to create a fragment in main activity so later i can add elements dynamically in, when i run the app i get this error:
04-29 19:32:47.318 E/ AndroidRuntime(27813): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class Fragment
When i try to run the app without the <Fragment> tag in main.xml it works
MainActivity:
package com.mycompany.myapp;
import android.os.Bundle;
import android.app.Activity;
public class MainActivity extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
main.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<Fragment
android:id="#+id/fL"
android:name="com.mycompany.myapp.MyFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
MyFragment:
package com.mycompany.myapp;
import android.os.Bundle;
import android.view.*;
import android.app.Fragment;
public class MyFragment extends Fragment
{
View root;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
super.onCreateView(inflater, container, savedInstanceState);
root = inflater.inflate(R.layout.fraglayout, container, false);
return root;
}
}
fraglayout.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.mycompany.myapp.MyFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
Also tried
class="com.mycompany.myapp.MyFragment"
instead ofandroid:name in main layout<fragment>
Full logCat(E):
04-29 20:11:03.444 E/dalvikvm(4221): heapsize Dalvik_dalvik_system_VMRuntime_nativeMinimumHeapSize 0
04-29 20:11:03.444 E/dalvikvm(4221): heapsize Dalvik_dalvik_system_VMRuntime_nativeMinimumHeapSize 15154664
04-29 20:11:03.945 E/AndroidRuntime(4221): FATAL EXCEPTION: main
04-29 20:11:03.945 E/AndroidRuntime(4221): Process: com.mycompany.myapp, PID: 4221
04-29 20:11:03.945 E/AndroidRuntime(4221): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class Fragment
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2342)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.ActivityThread.access$800(ActivityThread.java:151)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1266)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.os.Handler.dispatchMessage(Handler.java:102)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.os.Looper.loop(Looper.java:136)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.ActivityThread.main(ActivityThread.java:5421)
04-29 20:11:03.945 E/AndroidRuntime(4221): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 20:11:03.945 E/AndroidRuntime(4221): at java.lang.reflect.Method.invoke(Method.java:515)
04-29 20:11:03.945 E/AndroidRuntime(4221): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:979)
04-29 20:11:03.945 E/AndroidRuntime(4221): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795)
04-29 20:11:03.945 E/AndroidRuntime(4221): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
04-29 20:11:03.945 E/AndroidRuntime(4221): at dalvik.system.NativeStart.main(Native Method)
04-29 20:11:03.945 E/AndroidRuntime(4221): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class Fragment
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-29 20:11:03.945 E/AndroidRuntime(4221): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:296)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.Activity.setContentView(Activity.java:1941)
04-29 20:11:03.945 E/AndroidRuntime(4221): at com.mycompany.myapp.MainActivity.onCreate(MainActivity.java:13)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.Activity.performCreate(Activity.java:5264)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1099)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282)
04-29 20:11:03.945 E/AndroidRuntime(4221): ... 12 more
04-29 20:11:03.945 E/AndroidRuntime(4221): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.Fragment" on path: DexPathList[[zip file "/data/app/com.mycompany.myapp-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.mycompany.myapp-2, /vendor/lib, /system/lib]]
04-29 20:11:03.945 E/AndroidRuntime(4221): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-29 20:11:03.945 E/AndroidRuntime(4221): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
04-29 20:11:03.945 E/AndroidRuntime(4221): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
04-29 20:11:03.945 E/AndroidRuntime(4221): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
04-29 20:11:03.945 E/AndroidRuntime(4221): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
04-29 20:11:03.945 E/AndroidRuntime(4221): ... 22 more
*Sorry couldnt formate it cause SE app crash when trying to formate the code.

Try using lowercase "f" instead of uppercase letter "F" on main.xml layout while writing Fragment:
// <<<< start with lowercase
<fragment
android:id="#+id/fL"
android:name="com.mycompany.myapp.MyFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Some explanation about the solution I have found on another question:
Fragments when defined in XML aren't actually views. The full view
name is specified, or it assumes android.view for the package and
finds the rest. But a fragment is only truly specified when it
includes the android:name tag. It acts like a keyword, which are
typically written in lower case. Thus, Fragment refers to the class,
and fragment is the placeholder in XML for fragments.
As Andrew mentioned in the comments, any special item, such as
and are written in lower case, as they are not
android.view's.
Source: https://stackoverflow.com/a/21948080/3669559

Related

Presenting Facebook Share Dialog causes Facebook crash

When displaying a Facebook share dialog using the following code, the Facebook crashes.
FacebookDialog.ShareDialogBuilder builder =
new FacebookDialog.ShareDialogBuilder(activity);
FacebookDialog shareDialog = builder.build();
return shareDialog.present();
This is the stack trace that is returned:
04-29 15:47:52.929 32647-32647/? E/ACRA﹕ ACRA caught a StackOverflowError exception for com.facebook.katana. Building report.
04-29 15:47:52.934 2214-2214/? E/display﹕ invalid gralloc handle (at 0x0)
04-29 15:47:52.944 32647-32647/? E/fb4a(:<default>):ACRA﹕ Handling exception for crash
java.lang.StackOverflowError
at android.os.Parcel.writeInt(Parcel.java:484)
at android.os.Parcel.writeArrayMapInternal(Parcel.java:608)
at android.os.Bundle.writeToParcel(Bundle.java:1692)
at android.os.Parcel.writeBundle(Parcel.java:636)
at android.os.Parcel.writeValue(Parcel.java:1201)
...
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ java.lang.StackOverflowError
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeInt(Parcel.java:484)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeArrayMapInternal(Parcel.java:608)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Bundle.writeToParcel(Bundle.java:1692)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeBundle(Parcel.java:636)
04-29 15:47:54.609 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeValue(Parcel.java:1201)
...
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeArrayMapInternal(Parcel.java:618)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Bundle.writeToParcel(Bundle.java:1692)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Parcel.writeBundle(Parcel.java:636)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.content.Intent.writeToParcel(Intent.java:7414)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityManagerProxy.finishActivity(ActivityManagerNative.java:2480)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.Activity.finish(Activity.java:4303)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.base.activity.FbFragmentActivity.finish(FbFragmentActivity.java:313)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.a(PlatformWrapperActivity.java:489)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.e(PlatformWrapperActivity.java:401)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.c(PlatformWrapperActivity.java:374)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.platform.common.activity.PlatformWrapperActivity.a(PlatformWrapperActivity.java:269)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.facebook.base.activity.FbFragmentActivity.onCreate(FbFragmentActivity.java:171)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.Activity.performCreate(Activity.java:5428)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.access$800(ActivityThread.java:164)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Handler.dispatchMessage(Handler.java:102)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.os.Looper.loop(Looper.java:157)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at android.app.ActivityThread.main(ActivityThread.java:5350)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at java.lang.reflect.Method.invokeNative(Native Method)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at java.lang.reflect.Method.invoke(Method.java:515)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ at dalvik.system.NativeStart.main(Native Method)
04-29 15:47:54.624 32647-32647/? E/CatchMeIfYouCan﹕ Process (<default>) is exiting...
It appears that FbFragmentActivity.finish is causing a stack overflow trying to create a parcel, but I can't determine what is causing that process to enter an infinite loop. So far this has only been replicable on Samsung devices.
Edit:
Removed debug code from code snippet.

How to create database on network hard drive?

this how i try to create a sqlite database on network hard disk (seagate wireless)
public DBControllerClient(Context applicationcontext) {
super(applicationcontext,"smb://172.25.0.1/Public-01/Documents/NouveauDB.db", null, 1);
Log.d(LOGCAT,"Created DBController");
}
Firt : can i do that to create db ?
When i try to see all data, i have this mistakes : file "smb://172.25.0.1/Public-01/Documents/NouveauDB.db" contains a path separator.
this is my logcat :
04-29 10:08:47.310: E/AndroidRuntime(4405): FATAL EXCEPTION: main
04-29 10:08:47.310: E/AndroidRuntime(4405): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.opencv.samples.facedetect/com.client.FicheClient1}: java.lang.IllegalArgumentException: File smb://172.25.0.1/Public-01/Documents/NouveauDB.db contains a path separator
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2194)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2244)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.access$600(ActivityThread.java:141)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.os.Looper.loop(Looper.java:137)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.main(ActivityThread.java:5060)
04-29 10:08:47.310: E/AndroidRuntime(4405): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 10:08:47.310: E/AndroidRuntime(4405): at java.lang.reflect.Method.invoke(Method.java:511)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-29 10:08:47.310: E/AndroidRuntime(4405): at dalvik.system.NativeStart.main(Native Method)
04-29 10:08:47.310: E/AndroidRuntime(4405): Caused by: java.lang.IllegalArgumentException: File smb://172.25.0.1/Public-01/Documents/NouveauDB.db contains a path separator
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ContextImpl.makeFilename(ContextImpl.java:1992)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ContextImpl.validateFilePath(ContextImpl.java:1976)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:866)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.client.DBControllerClient.getAllClient(DBControllerClient.java:126)
04-29 10:08:47.310: E/AndroidRuntime(4405): at com.client.FicheClient1.onCreate(FicheClient1.java:370)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.Activity.performCreate(Activity.java:5146)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
04-29 10:08:47.310: E/AndroidRuntime(4405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2156)
04-29 10:08:47.310: E/AndroidRuntime(4405): ... 11 more
How can i do to solve my problem please ?
thx for your lights

Memory/Thread related Crash on Orientation change?

Friends,
onCreate() I am loading data from webservice using Async thread.
when thread is started it shows progress bar on screen and loads data.
A sudden problem I have faced is when I start that activity progress bar is shown I change orientation of my phone second thread starts &
Application crashes.(Inovation Target Exception something like that).
Here is the log cat any one guide me what is the solution to this problem?
Code is simple
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.searchbanks);
threadBank = new AsyncBanks();
threadBank.execute("","");
}
04-29 16:08:26.811: ERROR/WindowManager(430): Activity com.FindMe.SearchBanks has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44f64f98 that was originally added here
04-29 16:08:26.811: ERROR/WindowManager(430): android.view.WindowLeaked: Activity com.FindMe.SearchBanks has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView#44f64f98 that was originally added here
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.ViewRoot.<init>(ViewRoot.java:247)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.Dialog.show(Dialog.java:241)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks$AsyncBanks.onPreExecute(SearchBanks.java:133)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.AsyncTask.execute(AsyncTask.java:391)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks.LoadRecords(SearchBanks.java:115)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.FindMe.SearchBanks.onCreate(SearchBanks.java:76)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.os.Looper.loop(Looper.java:123)
04-29 16:08:26.811: ERROR/WindowManager(430): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:08:26.811: ERROR/WindowManager(430): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:08:26.811: ERROR/WindowManager(430): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:08:26.811: ERROR/WindowManager(430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:08:26.811: ERROR/WindowManager(430): at dalvik.system.NativeStart.main(Native Method)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): java.lang.IllegalArgumentException: View not attached to window manager
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:200)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.view.Window$LocalWindowManager.removeView(Window.java:432)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.dismissDialog(Dialog.java:278)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.access$000(Dialog.java:71)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog$1.run(Dialog.java:111)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.Dialog.dismiss(Dialog.java:268)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.FindMe.SearchBanks$AsyncBanks.onPostExecute(SearchBanks.java:197)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.FindMe.SearchBanks$AsyncBanks.onPostExecute(SearchBanks.java:1)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask.finish(AsyncTask.java:417)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask.access$300(AsyncTask.java:127)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.os.Looper.loop(Looper.java:123)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:08:28.652: ERROR/AndroidRuntime(430): at dalvik.system.NativeStart.main(Native Method)
Even if you dismiss your dialog so that you can recreate it, there seems to be a race condition between the system destroying the dialog and the lifecycle methods where you would dismiss it. Very rarely I get a crash report about dismissing a non-existent dialog at configuration change time.
I suggest catching and ignoring the exception in Dialog.dismiss() just to handle the race condition. That's what I've done and it's cleared up my problem.
Steve # WhitneyApps
Finally i got answer myself.
How to deal with orientation change with a ProgressDialog showing?
And
How to handle Activity when Orientation changes?

Error in Running an aplication with tabActivity

I am developing a simple example for TabActivity...When i am trying to run...It shows the following exceptions.... log cat view....
04-29 16:13:04.870: ERROR/Zygote(33): setreuid() failed. errno: 2
04-29 16:13:17.520: ERROR/Zygote(33): setreuid() failed. errno: 17
04-29 16:13:20.940: ERROR/BatteryService(60): usbOnlinePath not found
04-29 16:13:20.940: ERROR/BatteryService(60): batteryVoltagePath not found
04-29 16:13:20.940: ERROR/BatteryService(60): batteryTemperaturePath not found
04-29 16:13:20.980: ERROR/SurfaceFlinger(60): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
04-29 16:13:33.001: ERROR/EventHub(60): could not get driver version for /dev/input/mouse0, Not a typewriter
04-29 16:13:33.001: ERROR/EventHub(60): could not get driver version for /dev/input/mice, Not a typewriter
04-29 16:13:33.401: ERROR/System(60): Failure starting core service
04-29 16:13:33.401: ERROR/System(60): java.lang.SecurityException
04-29 16:13:33.401: ERROR/System(60): at android.os.BinderProxy.transact(Native Method)
04-29 16:13:33.401: ERROR/System(60): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
04-29 16:13:33.401: ERROR/System(60): at android.os.ServiceManager.addService(ServiceManager.java:72)
04-29 16:13:33.401: ERROR/System(60): at com.android.server.ServerThread.run(SystemServer.java:184)
04-29 16:13:35.430: ERROR/SoundPool(60): error loading /system/media/audio/ui/Effect_Tick.ogg
04-29 16:13:35.450: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressStandard.ogg
04-29 16:13:35.470: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressSpacebar.ogg
04-29 16:13:35.480: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressDelete.ogg
04-29 16:13:35.500: ERROR/SoundPool(60): error loading /system/media/audio/ui/KeypressReturn.ogg
04-29 16:13:39.790: ERROR/ThrottleService(60): Could not open GPS configuration file /etc/gps.conf
04-29 16:13:42.600: ERROR/logwrapper(153): executing /system/bin/tc failed: No such file or directory
04-29 16:13:42.691: ERROR/logwrapper(154): executing /system/bin/tc failed: No such file or directory
04-29 16:13:42.800: ERROR/logwrapper(155): executing /system/bin/tc failed: No such file or directory
04-29 16:14:06.081: ERROR/HierarchicalStateMachine(60): TetherMaster - unhandledMessage: msg.what=3
04-29 16:14:50.237: ERROR/AndroidRuntime(301): FATAL EXCEPTION: main
04-29 16:14:50.237: ERROR/AndroidRuntime(301): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android/com.android.tab_sample}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.os.Looper.loop(Looper.java:123)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at dalvik.system.NativeStart.main(Native Method)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.TabActivity.onContentChanged(TabActivity.java:105)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.Activity.setContentView(Activity.java:1647)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at com.android.tab_sample.onCreate(tab_sample.java:14)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-29 16:14:50.237: ERROR/AndroidRuntime(301): ... 11 more
04-29 16:29:46.777: ERROR/AndroidRuntime(738): FATAL EXCEPTION: main
04-29 16:29:46.777: ERROR/AndroidRuntime(738): **java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android/com.android.tab_sample}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'**
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.os.Looper.loop(Looper.java:123)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at dalvik.system.NativeStart.main(Native Method)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.TabActivity.onContentChanged(TabActivity.java:105)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.Activity.setContentView(Activity.java:1647)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at com.android.tab_sample.onCreate(tab_sample.java:14)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-29 16:29:46.777: ERROR/AndroidRuntime(738): ... 11 more
and my code is....
package com.android;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
public class tab_sample extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_sample);
TabHost tab=(TabHost)findViewById(R.id.tabhost);
tab.setup();
Resources res=getResources();
//tab=getTabHost();
Intent int1=new Intent(this,tab1.class);
Intent int2=new Intent(this,tab2.class);
tab.addTab(tab.newTabSpec("tab1").setIndicator("Songs",res.getDrawable(R.drawable.tab1)).setContent(int1));
tab.addTab(tab.newTabSpec("tab2").setIndicator("Movie",res.getDrawable(R.drawable.tab2)).setContent(int2));
//tab.addTab(tab.newTabSpec("tab3"))
tab.setCurrentTab(0);
}
}
please help me to solve this problem....
in xml, your tabhost id should be id="#android:id/tabhost" Check this: Android Tab Host
Some important logcat lines are:
16:29:46.777: ERROR/AndroidRuntime(738): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost' 04-29 16:29:46.777:
It seems like it can't find your id, but that's weird since that should give a compiling error. Are you changing/creating the id's dynamically somehow?
If you're using some other activities from a library, make sure the layout files are different. E.g. avoid having double main.xml files.

Menu button force close android?

I have and application that worked fine when you opened the menu button and went to the settings then pushed the back button but when I added the Google maps API into my application the back button force closes the application. Has there been any one else with this same issue? If so how did you fix it? Or does anyone know how to fix this problem?
Edit:
My log cat errors on back button force close
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): FATAL EXCEPTION: main
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): java.lang.RuntimeException: Unable to resume activity {www.Freshapp.com.Thumper.html/www.Freshapp.com.Thumper.html.Thumper}: java.lang.NullPointerException
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3128)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2059)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.os.Looper.loop(Looper.java:123)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at java.lang.reflect.Method.invokeNative(Native Method)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at java.lang.reflect.Method.invoke(Method.java:521)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at dalvik.system.NativeStart.main(Native Method)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): Caused by: java.lang.NullPointerException
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at com.google.android.maps.MapActivity.onResume(MapActivity.java:431)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at www.Freshapp.com.Thumper.html.Thumper.onResume(Thumper.java:181)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.Activity.performResume(Activity.java:3823)
04-29 16:02:13.155: ERROR/AndroidRuntime(16828): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
Edit 2
I took out my map view and the sliding drawer that the map view was in and everything to do with the map and the application gets no FC.
-Thanks
I figured it out, I just needed to add a back button function inside of my Setting. Works great now
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(null,"In on Key Down");
if (keyCode == KeyEvent.KEYCODE_BACK) {
Intent intent=new Intent(Settings.this,Thumper.class);
startActivity(intent);
return true;
}
return false;
}

Categories

Resources