I tried alot added all libraries with no use and followed documentation to make it work any help would be appreciated
Here's what appear at my logcat:
05-18 17:26:50.480: E/dalvikvm(5818): Could not find class 'com.google.maps.android.utils.demo.ClusteringDemoActivity', referenced from method com.google.maps.android.utils.demo.MainActivity.onCreate
05-18 17:26:50.552: E/AndroidRuntime(5818): FATAL EXCEPTION: main
05-18 17:26:50.552: E/AndroidRuntime(5818): java.lang.NoClassDefFoundError: com.google.maps.android.utils.demo.ClusteringDemoActivity
05-18 17:26:50.552: E/AndroidRuntime(5818): at com.google.maps.android.utils.demo.MainActivity.onCreate(MainActivity.java:22)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.Activity.performCreate(Activity.java:5133)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.os.Looper.loop(Looper.java:137)
05-18 17:26:50.552: E/AndroidRuntime(5818): at android.app.ActivityThread.main(ActivityThread.java:5103)
05-18 17:26:50.552: E/AndroidRuntime(5818): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 17:26:50.552: E/AndroidRuntime(5818): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 17:26:50.552: E/AndroidRuntime(5818): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
05-18 17:26:50.552: E/AndroidRuntime(5818): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-18 17:26:50.552: E/AndroidRuntime(5818): at dalvik.system.NativeStart.main(Native Method)
Related
05-18 19:05:06.591: E/AndroidRuntime(23525): FATAL EXCEPTION: main
05-18 19:05:06.591: E/AndroidRuntime(23525): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fbtest/com.example.fbtest.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.facebook.login.widget.LoginButton
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2424)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.access$600(ActivityThread.java:169)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.os.Handler.dispatchMessage(Handler.java:107)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.os.Looper.loop(Looper.java:194)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.main(ActivityThread.java:5433)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:924)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
05-18 19:05:06.591: E/AndroidRuntime(23525): at dalvik.system.NativeStart.main(Native Method)
05-18 19:05:06.591: E/AndroidRuntime(23525): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.facebook.login.widget.LoginButton
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Activity.setContentView(Activity.java:1895)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.example.fbtest.MainActivity.onCreate(MainActivity.java:23)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Activity.performCreate(Activity.java:5179)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2336)
05-18 19:05:06.591: E/AndroidRuntime(23525): ... 11 more
05-18 19:05:06.591: E/AndroidRuntime(23525): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.login.widget.LoginButton" on path: DexPathList[[zip file "/data/app/com.example.fbtest-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.fbtest-2, /vendor/lib, /system/lib, /data/datalib]]
05-18 19:05:06.591: E/AndroidRuntime(23525): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
05-18 19:05:06.591: E/AndroidRuntime(23525): ... 21 more
Have you import sdk library into eclipse,have you mark project As Library, and import that to your project?
This is my error after I run App. After importing Facebook 4.1.2 project it says that I need Java 1.7, android support v4 and Bolts-Android so I updated my Android tools library from last version and it's showing an error.
05-18 19:05:06.591: E/AndroidRuntime(23525): FATAL EXCEPTION: main
05-18 19:05:06.591: E/AndroidRuntime(23525): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fbtest/com.example.fbtest.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.facebook.login.widget.LoginButton
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2372)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2424)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.access$600(ActivityThread.java:169)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1388)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.os.Handler.dispatchMessage(Handler.java:107)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.os.Looper.loop(Looper.java:194)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.main(ActivityThread.java:5433)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:924)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:691)
05-18 19:05:06.591: E/AndroidRuntime(23525): at dalvik.system.NativeStart.main(Native Method)
05-18 19:05:06.591: E/AndroidRuntime(23525): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.facebook.login.widget.LoginButton
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:274)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Activity.setContentView(Activity.java:1895)
05-18 19:05:06.591: E/AndroidRuntime(23525): at com.example.fbtest.MainActivity.onCreate(MainActivity.java:23)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Activity.performCreate(Activity.java:5179)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1146)
05-18 19:05:06.591: E/AndroidRuntime(23525): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2336)
05-18 19:05:06.591: E/AndroidRuntime(23525): ... 11 more
05-18 19:05:06.591: E/AndroidRuntime(23525): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.login.widget.LoginButton" on path: DexPathList[[zip file "/data/app/com.example.fbtest-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.fbtest-2, /vendor/lib, /system/lib, /data/datalib]]
05-18 19:05:06.591: E/AndroidRuntime(23525): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-18 19:05:06.591: E/AndroidRuntime(23525): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
Images for xml and manifest are:
XML,MANIFEST
To remove this error, first place your Facebook SDK in your workspace and then import in eclipse.
I'm trying to develop some app with Google Maps API.
I'm followed this tutorial step by step and the app crashed!
I tried so many tutorials, even this one, but I get always the same error:
05-18 00:53:16.466: E/AndroidRuntime(17073): FATAL EXCEPTION: main
05-18 00:53:16.466: E/AndroidRuntime(17073): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemaps/com.example.googlemaps.MainActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2295)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.access$700(ActivityThread.java:159)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.os.Looper.loop(Looper.java:137)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.main(ActivityThread.java:5419)
05-18 00:53:16.466: E/AndroidRuntime(17073): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 00:53:16.466: E/AndroidRuntime(17073): at java.lang.reflect.Method.invoke(Method.java:525)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
05-18 00:53:16.466: E/AndroidRuntime(17073): at dalvik.system.NativeStart.main(Native Method)
05-18 00:53:16.466: E/AndroidRuntime(17073): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class fragment
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:361)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Activity.setContentView(Activity.java:1956)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.example.googlemaps.MainActivity.onCreate(MainActivity.java:20)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Activity.performCreate(Activity.java:5372)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)
05-18 00:53:16.466: E/AndroidRuntime(17073): ... 11 more
05-18 00:53:16.466: E/AndroidRuntime(17073): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4132500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.internal.q.v(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.internal.q.u(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapFragment$b.eb(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.dynamic.a.a(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.app.Activity.onCreateView(Activity.java:4965)
05-18 00:53:16.466: E/AndroidRuntime(17073): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
05-18 00:53:16.466: E/AndroidRuntime(17073): ... 21 more
Can someone help?
Replace #integer/google_play_services_version with 4132500
see this
google-play-services_lib --> res --> values --> version.xml
for the correct version of your google play services
selectQType a simple spinner. The values are getting populated from the DB and they are fine.
ArrayAdapter<String> spinnerArrayAdapter1 =
new ArrayAdapter<String>(SpotlighterBasicActivity.this,
android.R.layout.simple_spinner_item, spinnerQTypeList);
spinnerArrayAdapter1.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item);
Spinner selectQType=(Spinner) findViewById(R.id.spinnerInputQType);
selectQType.setPrompt("QType");// logcat points warning on this line.
selectQType.setAdapter(spinnerArrayAdapter1);
selectQType.setSelection(QTypeIndex);
selectQType.setOnItemSelectedListener(new OnItemSelectedListener() {
...
}
This is the output i get for Tablet:
Strange part is that it is working perfectly fine for mobile category of emulators and devices, but giving warning for tablet category of emulators and devices.
Following is the logcat detail:
05-18 16:47:29.284: E/SpotlighterBasicActivity(481): QTypeIndex=0
05-18 16:47:29.284: E/SpotlighterBasicActivity(481): spinnerArrayList[1]=Type 1, spinnerQTypeID=5853, defaultQType=6307
05-18 16:47:29.294: E/SpotlighterBasicActivity(481): spinnerArrayList[2]=Type 2, spinnerQTypeID=6308, defaultQType=6307
05-18 16:47:29.304: W/System.err(481): java.lang.NullPointerException
05-18 16:47:29.304: W/System.err(481): at in.varit.spotlighter.basic.SpotlighterBasicActivity.loadQTypeSpinners(SpotlighterBasicActivity.java:334)
05-18 16:47:29.304: W/System.err(481): at in.varit.spotlighter.basic.SpotlighterBasicActivity.onCreate(SpotlighterBasicActivity.java:203)
05-18 16:47:29.304: W/System.err(481): at android.app.Activity.performCreate(Activity.java:4397)
05-18 16:47:29.304: W/System.err(481): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread.access$500(ActivityThread.java:122)
05-18 16:47:29.313: W/System.err(481): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
05-18 16:47:29.325: W/System.err(481): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 16:47:29.325: W/System.err(481): at android.os.Looper.loop(Looper.java:132)
05-18 16:47:29.325: W/System.err(481): at android.app.ActivityThread.main(ActivityThread.java:4123)
05-18 16:47:29.325: W/System.err(481): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 16:47:29.325: W/System.err(481): at java.lang.reflect.Method.invoke(Method.java:491)
05-18 16:47:29.334: W/System.err(481): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-18 16:47:29.334: W/System.err(481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-18 16:47:29.334: W/System.err(481): at dalvik.system.NativeStart.main(Native Method)
selectQType is null And
check using if(null!=selectQType)
and also check id of selectQType is it right from layout.xml?
I have been struggling with the Android 3.0 SDK's fragments concept for a few days now, and thought I'd try StackOverflow....
I have a simple (proof on concept) app:
Here is my main layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout android:id="#+id/relativeLayout1" android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="200dp">
<fragment android:name="com.owentech.simplefragmentswap.staticfragment"
android:id="#+id/fragment1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_width="fill_parent"/>
</RelativeLayout>
<FrameLayout android:id="#+id/frameLayout1" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_above="#+id/relativeLayout1"></FrameLayout>
</RelativeLayout>
I display one fragment (staticfragment) directly in the XML, this works fine.
With the framelayout I wanted to add an XML fragment (fragment1) on create.
Here is fragment1:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:layout_height="wrap_content" android:id="#+id/button1" android:layout_alignParentTop="true" android:layout_width="match_parent" android:text="Fragment 1"></Button>
</RelativeLayout>
Here is my mainactivity:
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
public class mainActivity extends FragmentActivity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// Create new fragment and transaction
Fragment newFragment = new fragment1();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack
//transaction.replace(R.id.frameLayout1, newFragment);
transaction.add(R.id.frameLayout1, newFragment);
transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
}
}
This causes a force close on start.
Here is the logcat:
05-18 09:49:23.073: INFO/ActivityManager(71): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.owentech.simplefragmentswap/.mainActivity }
05-18 09:49:23.313: INFO/ActivityManager(71): Start proc com.owentech.simplefragmentswap for activity com.owentech.simplefragmentswap/.mainActivity: pid=451 uid=10036 gids={1015}
05-18 09:49:23.324: DEBUG/AndroidRuntime(445): Shutting down VM
05-18 09:49:23.333: DEBUG/dalvikvm(445): Debugger has detached; object registry had 1 entries
05-18 09:49:23.404: INFO/AndroidRuntime(445): NOTE: attach of thread 'Binder Thread #3' failed
05-18 09:49:24.433: DEBUG/AndroidRuntime(451): Shutting down VM
05-18 09:49:24.433: WARN/dalvikvm(451): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): FATAL EXCEPTION: main
**05-18 09:49:24.473: ERROR/AndroidRuntime(451): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.owentech.simplefragmentswap/com.owentech.simplefragmentswap.mainActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.**
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.os.Handler.dispatchMessage(Handler.java:99)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.os.Looper.loop(Looper.java:123)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at java.lang.reflect.Method.invokeNative(Native Method)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at java.lang.reflect.Method.invoke(Method.java:521)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at dalvik.system.NativeStart.main(Native Method)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.view.ViewGroup.addViewInner(ViewGroup.java:1970)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.view.ViewGroup.addView(ViewGroup.java:1865)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.view.ViewGroup.addView(ViewGroup.java:1822)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.view.ViewGroup.addView(ViewGroup.java:1802)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.support.v4.app.NoSaveStateFrameLayout.wrap(NoSaveStateFrameLayout.java:40)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:743)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:933)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:916)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:1587)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:500)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.Activity.performStart(Activity.java:3781)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2636)
05-18 09:49:24.473: ERROR/AndroidRuntime(451): ... 11 more
05-18 09:49:24.494: WARN/ActivityManager(71): Force finishing activity com.owentech.simplefragmentswap/.mainActivity
Does anybody know what I am doing wrong, as I have taken the code directly from developer.android.com
Thanks
Sorry, found the answer. When I inflated the view in my fragment1.java it was attached to root. changed the last flag to false, now ok.