Note that there are some explanatory texts on larger screens.

plurals
  1. POApplication crashes when home button press
    primarykey
    data
    text
    <p>hi frnds am developing an application which load a fragmentActivity. the fragment activity contains tabhost with 4 tabs, each tab load fragments. the application works smoothily when i run the application but, when we <strong>press the home button</strong> or any other apps runs then my <strong>application crashes...</strong>.</p> <p>this is my log cat</p> <pre><code>09-12 05:47:39.055: E/AndroidRuntime(3692): FATAL EXCEPTION: main 09-12 05:47:39.055: E/AndroidRuntime(3692): java.lang.RuntimeException: Parcel: unable to marshal value WelcomeFragment{40d3ae00} 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeValue(Parcel.java:1235) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeList(Parcel.java:622) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeValue(Parcel.java:1195) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeMapInternal(Parcel.java:591) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeMap(Parcel.java:575) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeValue(Parcel.java:1166) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeMapInternal(Parcel.java:591) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Bundle.writeToParcel(Bundle.java:1627) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Parcel.writeBundle(Parcel.java:605) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:2252) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3052) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Handler.handleCallback(Handler.java:725) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Handler.dispatchMessage(Handler.java:92) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.os.Looper.loop(Looper.java:137) 09-12 05:47:39.055: E/AndroidRuntime(3692): at android.app.ActivityThread.main(ActivityThread.java:5041) 09-12 05:47:39.055: E/AndroidRuntime(3692): at java.lang.reflect.Method.invokeNative(Native Method) 09-12 05:47:39.055: E/AndroidRuntime(3692): at java.lang.reflect.Method.invoke(Method.java:511) 09-12 05:47:39.055: E/AndroidRuntime(3692): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 09-12 05:47:39.055: E/AndroidRuntime(3692): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 09-12 05:47:39.055: E/AndroidRuntime(3692): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>and this is my tabActivity </p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); actionBar = getSupportActionBar(); actionBar.setDisplayShowCustomEnabled(true); View absView=LayoutInflater.from(this).inflate(R.layout.abs_layout, null); actionBar.setCustomView(absView); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); setContentView(R.layout.activity_tab_layout); tabHost =(TabHost) findViewById(R.id.myTabHost); tabHost.setup(); if (savedInstanceState != null) { initializeTabHost(); tabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); backStacks=(HashMap&lt;String, Stack&lt;Fragment&gt;&gt;) savedInstanceState.getSerializable("stacks"); } else { backStacks = new HashMap&lt;String, Stack&lt;Fragment&gt;&gt;(); for(int i=0;i&lt;stackKey.length;i++) backStacks.put(stackKey[i], new Stack&lt;Fragment&gt;()); initializeTabHost(); } } @Override protected void onSaveInstanceState(Bundle outState) { // super.onSaveInstanceState(outState); outState.putString("tab", tabHost.getCurrentTabTag()); outState.putSerializable("stacks", backStacks); } private void initializeTabHost() { tabHost.setOnTabChangedListener(this); addTab(this, stackKey[0], labels[0],WelcomeFragment.class,R.drawable.menu_home); addTab(this, stackKey[1], labels[1], ShopListFragment.class, R.drawable.menu_shops); addTab(this, stackKey[2], labels[2], MyDealsFragment.class, R.drawable.menu_mydeals); addTab(this, stackKey[3], labels[3], MyProfileFragment.class, R.drawable.menu_profile); addTab(this, stackKey[4], labels[4], SettingFragment.class, R.drawable.menu_settings_on); } private void addTab(TabActivity activity,String tag,int label,Class&lt;?&gt; class1, int image) { Stack&lt;Fragment&gt; backStack = backStacks.get(tag); View tabView=createTabView(label, image); TabSpec tabSpec = tabHost.newTabSpec(tag).setIndicator(tabView).setContent(activity.new TabFactory(activity)); Fragment fragment = (Fragment) Fragment.instantiate(activity, class1.getName(),null); if(backStack.isEmpty()) if(fragment!=null) backStack.push(fragment); tabHost.addTab(tabSpec); } </code></pre> <p>and this is my WelcomeFragment</p> <pre><code>public class WelcomeFragment extends Fragment { ViewPageAdapter mAdapter; ViewPager mPager; CirclePageIndicator mIndicator; List&lt;Fragment&gt; fragments; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.frag_welcome_layout,null); mPager=(ViewPager)view.findViewById(R.id.myViewPager); mIndicator=(CirclePageIndicator)view.findViewById(R.id.circlePageIndicator1); mAdapter = new ViewPageAdapter(getActivity()); mPager.setAdapter(mAdapter); mIndicator.setViewPager(mPager); return view; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload