Fragment onSaveInstanceState - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Fragment onSaveInstanceState method.

This code example shows how to use the following methods:onSaveInstanceState
		return v;
	} 
	 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt("mColorRes", mColorRes);
	} 
	 
} 
8
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
    } 
  } 
   
  @Override 
  public void onSaveInstanceState(Bundle state) {
    super.onSaveInstanceState(state);
     
    WebView browser=getBrowser();
     
    if (browser!=null) {
      browser.saveState(state);
    } 
  } 
   
  public void loadUrl(String url) {
    getBrowser().loadUrl(url);
  } 
   
  private WebView getBrowser() {
    return((WebView)(getView().findViewById(R.id.browser)));
7
CodeRank
This code example shows how to use the following methods:getArguments, onSaveInstanceState
            mPlaylistAdapter.changeCursor(null);
    } 
 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        outState.putAll(getArguments() != null ? getArguments() : new Bundle());
        super.onSaveInstanceState(outState);
    } 
 
    @Override 
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
 
        AdapterContextMenuInfo mi = (AdapterContextMenuInfo)menuInfo;
 
        menu.add(0, PLAY_SELECTION, 0, getResources().getString(R.string.play_all));
 
        if (mi.id >= 0) {
            menu.add(0, RENAME_PLAYLIST, 0, getResources().getString(R.string.rename_playlist));
            menu.add(0, DELETE_PLAYLIST, 0, getResources().getString(R.string.delete_playlist));
        } 
7
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
	// Called during the lifecycle, when instance state should be saved/restored 
	// //////////////////////////////////////////////////////////////////////////// 
 
	@Override 
	public void onSaveInstanceState(Bundle toSave) {
		super.onSaveInstanceState(toSave);
		Log.i(TAG, "onSaveinstanceState");
	} 
} 
6
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
     * that contains previously saved states in this method. 
     */ 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        Log.v(TAG, "onSaveInstanceState");
        super.onSaveInstanceState(outState);
    } 
 
    /** 
     * <blockquote> 
     * ユーザが画面遷移などで {@link Fragment} から去ることを最初に通知するものとして、システムは onPause() を呼び出します。 
     * ただしこれは、即ち {@link Fragment} が破棄されつつあることを意味するものではありません。 
     * ここでは、{@link Activity} の {@link Context} などを超える、永続化すべきデータを保存しておきます(ユーザが戻ってこないこともあるため)。 
     * 
     * onPause() が呼ばれたら、{@link Fragment} はユーザの操作を受け付けなくなります。これは、 {@link Activity#onPause()} が呼ばれた後に 
     * {@link Fragment#onPause()} が呼ばれるため、{@link Activity} もまた操作を受け付けなくなるからです。 
     * </blockquote> 
     * 
     * <blockquote> 
     * The system calls this method as the first indication that the user is leaving the {@link Fragment} 
6
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
     * the system to restart the Fragment later on. 
     */ 
    @Override 
    public void onSaveInstanceState(Bundle bundle) {
        // Always call the super method first 
        super.onSaveInstanceState(bundle);
         
        // Puts the current URL for the picture being shown into the saved state 
        bundle.putString(PHOTO_URL_KEY, mURLString);
    } 
 
    /** 
     * Sets the photo for this Fragment, by storing a URL that points to a picture 
     * @param urlString A String representation of the URL pointing to the picture 
     */ 
    public void setPhoto(String urlString) {
        mURLString = urlString;
    } 
} 
6
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
	} 
 
 
	@Override 
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
 
		outState.putBoolean(ONSCREEN_CALCULATOR_ENABLED, onscreenCalculatorEnabled);
	} 
 
	@Nullable 
	CheckBox getOnscreenCalculatorCheckbox() {
		return onscreenCalculatorCheckbox;
	} 
} 
 
6
CodeRank
This code example shows how to use the following methods:onSaveInstanceState, setUserVisibleHint
     * http://stackoverflow.com/questions/8748064/starting-activity-from 
     * -fragment-causes-nullpointerexception 
     */ 
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        setUserVisibleHint(true);
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 
        // load html from html file from /res/raw 
        InputStream inputStreamText = this.getActivity().getResources().openRawResource(R.raw.help);
 
        mActivity = getActivity();
 
        LinearLayout layout = new LinearLayout(mActivity);
 
        JellyBeanSpanFixTextView text = new JellyBeanSpanFixTextView(mActivity);
5
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
	return v;
    } 
     
    @Override 
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putBoolean("dummy", true);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:onSaveInstanceState
	 
	@SuppressWarnings("deprecation") 
	@Override 
    public void onSaveInstanceState(Bundle outState) {
		if(DEBUG) Log.d(TAG, ".onSaveInstanceState()...");
        super.onSaveInstanceState(outState);
        outState.putBundle(KEY_STATE_BUNDLE, mLocalActivityManager.saveInstanceState());
    } 
	 
	@SuppressWarnings("deprecation") 
	@Override 
	public void onPause() { 
		if(DEBUG) Log.d(TAG, ".onAttach()...");
		mLocalActivityManager.dispatchPause(getActivity().isFinishing());
		super.onPause(); 
	} 
	 
	@Override 
	public void onStop() { 
		if(DEBUG) Log.d(TAG, ".onStop()...");
5
CodeRank

Related Fragment onSaveInstanceState Questions & Answers:

onSaveInstanceState Method Overview
Called to ask the fragment to save its current dynamic state, so it can later be reconstructed in a new instance of its process is restarted.
See Code Examples for other Android Fragment Methods: