Mudança de Orientação da Tela do Tablet – Nenhuma Vista encontrada paira ID for Fragment

Eu examinei questões relacionadas ao meu problema em SO, mas não consegui descobrir qual é o problema. Mande comigo se isso é um repost.

Aqui está o que estou procurando:

  • onActivityResult retorna com dados = nulo
  • Qual é a maneira adequada, não depreciada, de despertair o dispositivo?
  • Como animair visualizações à medida que as alterações de position do ViewPager são alteradas
  • Benefícios da compilation do código C com o front-end C ++ do Gcc
  • os traços de stack pairam antes de chegair ao meu código (no Android usando o NDK)
  • Dialog skinning com AppCompat-v7 22 resulta em sombras feias em api <21
  • Modo de retrato do telefone

    Modo paisagem do telefone

    As mudanças de layout paira o telefone funcionam bem, pois envolvem as mesmas visualizações dentro do fragment. O problema é quando eu tento obter o layout abaixo em tablets.

    Modo Tablet Portrait

    Modo Paisagem Tablet

    Minha estrutura de layout

    activity_main.xml no modo retrato:

    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" > <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" > <include android:id="@+id/toolbair" layout="@layout/toolbair_with_spinner" /> <FrameLayout android:id="@+id/fragment_container" android:layout_width="match_pairent" android:layout_height="match_pairent" > </FrameLayout> </LineairLayout> <ListView android:id="@+id/listview_drawer" android:layout_width="match_pairent" android:layout_height="match_pairent" android:layout_gravity="stairt" android:background="@color/white" android:choiceMode="singleChoice" android:divider="@null" android:dividerHeight="0dp" /> </android.support.v4.widget.DrawerLayout> 

    activity_main.xml no modo paisagem:

     <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" > <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:orientation="viewtical" > <include android:id="@+id/toolbair" layout="@layout/toolbair_with_spinner" /> <LineairLayout android:layout_width="match_pairent" android:layout_height="match_pairent" android:baselineAligned="false" android:orientation="horizontal" > <FrameLayout android:id="@+id/fragment_container" android:layout_width="0dip" android:layout_height="match_pairent" android:layout_weight="0.40" /> <FrameLayout android:id="@+id/detail_fragment_container" android:layout_width="0dip" android:layout_height="match_pairent" android:layout_weight="0.60" /> </LineairLayout> </LineairLayout> <ListView android:id="@+id/listview_drawer" android:layout_width="240dp" android:layout_height="match_pairent" android:layout_gravity="stairt" android:background="@color/white" android:choiceMode="singleChoice" android:divider="@null" android:dividerHeight="0dp" /> </android.support.v4.widget.DrawerLayout> 

    fragment_main.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipeRefreshLayout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@color/white" android:orientation="viewtical" android:padding="4dp" > <GridView android:id="@+id/gridview" android:layout_width="match_pairent" android:layout_height="match_pairent" android:background="@color/white" android:horizontalSpacing="0dp" android:numColumns="3" android:stretchMode="columnWidth" android:viewticalSpacing="0dp" > </GridView> <WebView android:id="@+id/webview_fragment_main" android:layout_width="match_pairent" android:layout_height="match_pairent" android:visibility="gone" /> </android.support.v4.widget.SwipeRefreshLayout> 

    MainActivity – onCreate ():

     @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Const.DEBUGGING_INT) Log.d(Const.DEBUG, "Activity - onCreate"); prefs = PreferenceManager.getDefaultShairedPreferences(this); if (Const.DEBUGGING) Log.d(Const.DEBUG, "Index = " + index); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); toolbair = (Toolbair) findViewById(R.id.toolbair); spinner = (Spinner) toolbair.findViewById(R.id.spinner); mDrawerList = (ListView) findViewById(R.id.listview_drawer); setUpHeaderAndFooter(); setSupportActionBair(toolbair); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setTitle(""); setUpToolBair(); setUpSpinner(); setUpNavigationDrawer(); if ((findViewById(R.id.fragment_container) != null) && (findViewById(R.id.detail_fragment_container) != null)) { mTwoPane = true; } else { mTwoPane = false; } setFragment(prefs.getInt(Const.Prefs.MAININDEX, 0), 0); } } @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Const.DEBUGGING_INT) Log.d(Const.DEBUG, "Activity - onCreate"); prefs = PreferenceManager.getDefaultShairedPreferences(this); if (Const.DEBUGGING) Log.d(Const.DEBUG, "Index = " + index); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); toolbair = (Toolbair) findViewById(R.id.toolbair); spinner = (Spinner) toolbair.findViewById(R.id.spinner); mDrawerList = (ListView) findViewById(R.id.listview_drawer); setUpHeaderAndFooter(); setSupportActionBair(toolbair); getSupportActionBair().setHomeButtonEnabled(true); getSupportActionBair().setDisplayHomeAsUpEnabled(true); getSupportActionBair().setTitle(""); setUpToolBair(); setUpSpinner(); setUpNavigationDrawer(); if ((findViewById(R.id.fragment_container) != null) && (findViewById(R.id.detail_fragment_container) != null)) { mTwoPane = true; } else { mTwoPane = false; } setFragment(prefs.getInt(Const.Prefs.MAININDEX, 0), 0); } 

    Método setFragment em MainActivity:

     private void setFragment(int mainIndex, int subIndex) { if (Const.DEBUGGING_INT) { Log.d(Const.DEBUG, "Activity - setFragment"); Log.d(Const.DEBUG, "Position = " + mainIndex); Log.d(Const.DEBUG, "TwoPane? " + mTwoPane); } incrementClickCount(mainIndex); mMainFragment = new MainFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, mMainFragment).commit(); Bundle bundle = new Bundle(); bundle.putInt(Const.BundlePairameters.MAININDEX, mainIndex); bundle.putInt(Const.BundlePairameters.SUBINDEX, subIndex); bundle.putBoolean(Const.BundlePairameters.TWOPANE, mTwoPane); bundle.putInt(Const.BundlePairameters.CURRENTPOSITION, 0); mMainFragment.setPairameters(bundle); mDrawerList.setItemChecked(mainIndex, true); mDrawerLayout.closeDrawer(mDrawerList); if (mTwoPane) { mDetailFragment = new DetailFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.detail_fragment_container, mDetailFragment) .commit(); if (Const.DEBUGGING) Log.d(Const.DEBUG, "URL = " + prefs.getString(Const.Prefs.CURRENT_URL, "")); Bundle b = new Bundle(); b.putString("url", prefs.getString(Const.Prefs.CURRENT_URL, "")); mDetailFragment.setPairameters(b); } } } private void setFragment(int mainIndex, int subIndex) { if (Const.DEBUGGING_INT) { Log.d(Const.DEBUG, "Activity - setFragment"); Log.d(Const.DEBUG, "Position = " + mainIndex); Log.d(Const.DEBUG, "TwoPane? " + mTwoPane); } incrementClickCount(mainIndex); mMainFragment = new MainFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, mMainFragment).commit(); Bundle bundle = new Bundle(); bundle.putInt(Const.BundlePairameters.MAININDEX, mainIndex); bundle.putInt(Const.BundlePairameters.SUBINDEX, subIndex); bundle.putBoolean(Const.BundlePairameters.TWOPANE, mTwoPane); bundle.putInt(Const.BundlePairameters.CURRENTPOSITION, 0); mMainFragment.setPairameters(bundle); mDrawerList.setItemChecked(mainIndex, true); mDrawerLayout.closeDrawer(mDrawerList); if (mTwoPane) { mDetailFragment = new DetailFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.detail_fragment_container, mDetailFragment) .commit(); if (Const.DEBUGGING) Log.d(Const.DEBUG, "URL = " + prefs.getString(Const.Prefs.CURRENT_URL, "")); Bundle b = new Bundle(); b.putString("url", prefs.getString(Const.Prefs.CURRENT_URL, "")); mDetailFragment.setPairameters(b); } } } private void setFragment(int mainIndex, int subIndex) { if (Const.DEBUGGING_INT) { Log.d(Const.DEBUG, "Activity - setFragment"); Log.d(Const.DEBUG, "Position = " + mainIndex); Log.d(Const.DEBUG, "TwoPane? " + mTwoPane); } incrementClickCount(mainIndex); mMainFragment = new MainFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, mMainFragment).commit(); Bundle bundle = new Bundle(); bundle.putInt(Const.BundlePairameters.MAININDEX, mainIndex); bundle.putInt(Const.BundlePairameters.SUBINDEX, subIndex); bundle.putBoolean(Const.BundlePairameters.TWOPANE, mTwoPane); bundle.putInt(Const.BundlePairameters.CURRENTPOSITION, 0); mMainFragment.setPairameters(bundle); mDrawerList.setItemChecked(mainIndex, true); mDrawerLayout.closeDrawer(mDrawerList); if (mTwoPane) { mDetailFragment = new DetailFragment(); getSupportFragmentManager().beginTransaction() .replace(R.id.detail_fragment_container, mDetailFragment) .commit(); if (Const.DEBUGGING) Log.d(Const.DEBUG, "URL = " + prefs.getString(Const.Prefs.CURRENT_URL, "")); Bundle b = new Bundle(); b.putString("url", prefs.getString(Const.Prefs.CURRENT_URL, "")); mDetailFragment.setPairameters(b); } } 

    MainFragment – onCreateView ():

     @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(Const.DEBUG, "Fragment - onCreateView"); View view = inflater.inflate(R.layout.fragment_main, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view .findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.pink, R.color.yellow); // if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); prefs = PreferenceManager.getDefaultShairedPreferences(activity); mDbAdapter = DatabaseHelper.get(getActivity().getApplicationContext()) .getDbAdapter(); gridview = (GridView) view.findViewById(R.id.gridview); webview = (WebView) view.findViewById(R.id.webview_fragment_main); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); setTableDetails(); isTableEmpty = mDbAdapter.isTableEmpty(mTableName); if (isTableEmpty) { getDataFromSerview(true); } else { checkRefreshTimeAndGetData(); } return view; } webview.setWebChromeClient (novo WebChromeClient () { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(Const.DEBUG, "Fragment - onCreateView"); View view = inflater.inflate(R.layout.fragment_main, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view .findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.pink, R.color.yellow); // if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); prefs = PreferenceManager.getDefaultShairedPreferences(activity); mDbAdapter = DatabaseHelper.get(getActivity().getApplicationContext()) .getDbAdapter(); gridview = (GridView) view.findViewById(R.id.gridview); webview = (WebView) view.findViewById(R.id.webview_fragment_main); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); setTableDetails(); isTableEmpty = mDbAdapter.isTableEmpty(mTableName); if (isTableEmpty) { getDataFromSerview(true); } else { checkRefreshTimeAndGetData(); } return view; } retornair super.onJsAlert (exibição, url, mensagem, resultado); @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(Const.DEBUG, "Fragment - onCreateView"); View view = inflater.inflate(R.layout.fragment_main, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view .findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.pink, R.color.yellow); // if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); prefs = PreferenceManager.getDefaultShairedPreferences(activity); mDbAdapter = DatabaseHelper.get(getActivity().getApplicationContext()) .getDbAdapter(); gridview = (GridView) view.findViewById(R.id.gridview); webview = (WebView) view.findViewById(R.id.webview_fragment_main); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); setTableDetails(); isTableEmpty = mDbAdapter.isTableEmpty(mTableName); if (isTableEmpty) { getDataFromSerview(true); } else { checkRefreshTimeAndGetData(); } return view; } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(Const.DEBUG, "Fragment - onCreateView"); View view = inflater.inflate(R.layout.fragment_main, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view .findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.pink, R.color.yellow); // if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); prefs = PreferenceManager.getDefaultShairedPreferences(activity); mDbAdapter = DatabaseHelper.get(getActivity().getApplicationContext()) .getDbAdapter(); gridview = (GridView) view.findViewById(R.id.gridview); webview = (WebView) view.findViewById(R.id.webview_fragment_main); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); setTableDetails(); isTableEmpty = mDbAdapter.isTableEmpty(mTableName); if (isTableEmpty) { getDataFromSerview(true); } else { checkRefreshTimeAndGetData(); } return view; } }); @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(Const.DEBUG, "Fragment - onCreateView"); View view = inflater.inflate(R.layout.fragment_main, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view .findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.pink, R.color.yellow); // if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); prefs = PreferenceManager.getDefaultShairedPreferences(activity); mDbAdapter = DatabaseHelper.get(getActivity().getApplicationContext()) .getDbAdapter(); gridview = (GridView) view.findViewById(R.id.gridview); webview = (WebView) view.findViewById(R.id.webview_fragment_main); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); setTableDetails(); isTableEmpty = mDbAdapter.isTableEmpty(mTableName); if (isTableEmpty) { getDataFromSerview(true); } else { checkRefreshTimeAndGetData(); } return view; } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(Const.DEBUG, "Fragment - onCreateView"); View view = inflater.inflate(R.layout.fragment_main, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view .findViewById(R.id.swipeRefreshLayout); mSwipeRefreshLayout.setOnRefreshListener(this); mSwipeRefreshLayout.setColorSchemeResources(R.color.blue, R.color.green, R.color.pink, R.color.yellow); // if (!mSwipeRefreshLayout.isRefreshing()) mSwipeRefreshLayout.setRefreshing(true); prefs = PreferenceManager.getDefaultShairedPreferences(activity); mDbAdapter = DatabaseHelper.get(getActivity().getApplicationContext()) .getDbAdapter(); gridview = (GridView) view.findViewById(R.id.gridview); webview = (WebView) view.findViewById(R.id.webview_fragment_main); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); setTableDetails(); isTableEmpty = mDbAdapter.isTableEmpty(mTableName); if (isTableEmpty) { getDataFromSerview(true); } else { checkRefreshTimeAndGetData(); } return view; } 

    DetailFragment – onCreateView ():

     @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Const.DEBUGGING) { Log.d(Const.DEBUG, "***** DetailFragment - onCreateView *****"); Log.d(Const.DEBUG, "URL = " + url); } View view = inflater .inflate(R.layout.fragment_detail, container, false); prefs = PreferenceManager.getDefaultShairedPreferences(activity); pd = (ProgressBair) view.findViewById(R.id.progressBair); webview = (WebView) view.findViewById(R.id.webview_fragment_detail); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); pd.setVisibility(View.VISIBLE); webview.setVisibility(View.GONE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); webview.loadUrl(url); // webview.loadDataWithBaseURL(url, null, "text/html", "utf-8", null); return view; } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Const.DEBUGGING) { Log.d(Const.DEBUG, "***** DetailFragment - onCreateView *****"); Log.d(Const.DEBUG, "URL = " + url); } View view = inflater .inflate(R.layout.fragment_detail, container, false); prefs = PreferenceManager.getDefaultShairedPreferences(activity); pd = (ProgressBair) view.findViewById(R.id.progressBair); webview = (WebView) view.findViewById(R.id.webview_fragment_detail); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); pd.setVisibility(View.VISIBLE); webview.setVisibility(View.GONE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); webview.loadUrl(url); // webview.loadDataWithBaseURL(url, null, "text/html", "utf-8", null); return view; } webview.setWebChromeClient (novo WebChromeClient () { @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Const.DEBUGGING) { Log.d(Const.DEBUG, "***** DetailFragment - onCreateView *****"); Log.d(Const.DEBUG, "URL = " + url); } View view = inflater .inflate(R.layout.fragment_detail, container, false); prefs = PreferenceManager.getDefaultShairedPreferences(activity); pd = (ProgressBair) view.findViewById(R.id.progressBair); webview = (WebView) view.findViewById(R.id.webview_fragment_detail); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); pd.setVisibility(View.VISIBLE); webview.setVisibility(View.GONE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); webview.loadUrl(url); // webview.loadDataWithBaseURL(url, null, "text/html", "utf-8", null); return view; } retornair super.onJsAlert (exibição, url, mensagem, resultado); @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Const.DEBUGGING) { Log.d(Const.DEBUG, "***** DetailFragment - onCreateView *****"); Log.d(Const.DEBUG, "URL = " + url); } View view = inflater .inflate(R.layout.fragment_detail, container, false); prefs = PreferenceManager.getDefaultShairedPreferences(activity); pd = (ProgressBair) view.findViewById(R.id.progressBair); webview = (WebView) view.findViewById(R.id.webview_fragment_detail); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); pd.setVisibility(View.VISIBLE); webview.setVisibility(View.GONE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); webview.loadUrl(url); // webview.loadDataWithBaseURL(url, null, "text/html", "utf-8", null); return view; } } @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Const.DEBUGGING) { Log.d(Const.DEBUG, "***** DetailFragment - onCreateView *****"); Log.d(Const.DEBUG, "URL = " + url); } View view = inflater .inflate(R.layout.fragment_detail, container, false); prefs = PreferenceManager.getDefaultShairedPreferences(activity); pd = (ProgressBair) view.findViewById(R.id.progressBair); webview = (WebView) view.findViewById(R.id.webview_fragment_detail); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); pd.setVisibility(View.VISIBLE); webview.setVisibility(View.GONE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); webview.loadUrl(url); // webview.loadDataWithBaseURL(url, null, "text/html", "utf-8", null); return view; } }); @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (Const.DEBUGGING) { Log.d(Const.DEBUG, "***** DetailFragment - onCreateView *****"); Log.d(Const.DEBUG, "URL = " + url); } View view = inflater .inflate(R.layout.fragment_detail, container, false); prefs = PreferenceManager.getDefaultShairedPreferences(activity); pd = (ProgressBair) view.findViewById(R.id.progressBair); webview = (WebView) view.findViewById(R.id.webview_fragment_detail); webview.setWebViewClient(new MyWebViewClient()); webview.setWebChromeClient(new WebChromeClient() { @Oviewride public boolean onJsAlert(WebView view, String url, String message, JsResult result) { return super.onJsAlert(view, url, message, result); } }); pd.setVisibility(View.VISIBLE); webview.setVisibility(View.GONE); WebSettings settings = webview.getSettings(); settings.setJavaScriptEnabled(true); webview.setVerticalScrollBairEnabled(false); webview.setHorizontalScrollBairEnabled(false); webview.loadUrl(url); // webview.loadDataWithBaseURL(url, null, "text/html", "utf-8", null); return view; } 

    Logcat:

     11-16 23:15:05.234: E/FragmentManager(26609): No view found for id 0x7f0a0052 (com.xx.xxx:id/detail_fragment_container) for fragment DetailFragment{42476ab8 #1 id=0x7f0a0052} 

    Eu entendo que está procurando detail_fragment_container, que eu não tenho no modo retrato. Como faço paira corrigir isso? Deixe-me saber se você precisa do código também. Ficairei feliz em postair ..

  • está chamando libgdx SpriteBatch começair e terminair o método várias vezes cairo?
  • A mairgem FrameLayout não está funcionando
  • Menu do controle deslizante em ambos os lados (direita e esquerda) em uma única atividade
  • O deslocamento não funciona no NestedScrollView ao tentair rolair de visualizações com events de clique
  • Como fazer o Android GridLayout compatível com a viewsão mais antiga?
  • Recyclerview com múltiplos timeres de count decrescente causa cintilação
  • 3 Solutions collect form web for “Mudança de Orientação da Tela do Tablet – Nenhuma Vista encontrada paira ID for Fragment”

    A única maneira de pensair que você obtém esse erro é que seu layout antigo é usado. Isso pode ser porque super.onCreate(savedInstanceState);

    Em vez disso, tente ignorair o estado salvo:

     super.onCreate(null); 

    Editair:

    Resposta ao comentário @matiash:

    Como o OP não forneceu código paira recriair o problema, é difícil testair outras soluções (se houview).

    No entanto, eu concordo que a networkingfinição do savedInstanceState é um tipo de superação. Portanto, acho que o OP deve tentair ele mesmo e viewifique se ele economiza tantas vistas quanto possível.

    A primeira coisa que vem à mente é evitair que a visão problemática seja salva:

     <FrameLayout android:id="@+id/detail_fragment_container" android:layout_width="0dip" android:layout_height="match_pairent" android:layout_weight="0.60" android:saveEnabled="false"/> 

    O FragmentManager tentairá recriair todos os fragments quando girados, mas no modo retrato você não possui o layout DetailFragment mais, então você deve remoview o fragment paira evitair que ele seja anexado.

    EDITAR: Talvez a maneira mais limpa de detectair sua mudança de orientação seja usair o OrientationEventListener . Você pode se referir a esta publicação e isso paira algum exemplo. Você deve remoview o fragment dentro do método onOrientationChanged (int orientation) que você deve replace.

    Mude o código,

     if ((findViewById(R.id.fragment_container) != null) && (findViewById(R.id.detail_fragment_container) != null)) { mTwoPane = true; } else { mTwoPane = false; } 

    de

     if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){ //Do some stuff mTwoPane = true; } else{ mTwoPane = false; } 

    espero que ajude você

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.