2017-05-22 19 views

答えて

0

IcePickを使用できます。 https://github.com/frankiesardo/icepick

非常に使いやすいです。

class ExampleActivity extends Activity { 
    @State 
    String username; // This will be automatically saved and restored 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    Icepick.restoreInstanceState(this, savedInstanceState); 
    } 

    @Override 
    public void onSaveInstanceState(Bundle outState) { 
    super.onSaveInstanceState(outState); 
    Icepick.saveInstanceState(this, outState); 
    } 

    // You can put the calls to Icepick into a BaseActivity 
    // All Activities extending BaseActivity automatically have state saved/restored 
} 

@State表記を使用してください。

+1

ありがとう!私はちょうどそれを試したと私はそれが好きです。 –

関連する問題