- implement onSaveInstanceState(Bundle state)
- implement onRestoreInstanceState(Bundle state)
- input controlls are saved automatically
- listview items/position etc need to be saved.
- to persist for the long term use SQLite db, shared prefrences or a file
// Copyright 2016, Google Inc. All Rights Reserved. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
this gist has the data for this sample db |
read.me |
//Add before making a phone call | |
if (ActivityCompat.checkSelfPermission( | |
MainActivity.this, Manifest.permission.CALL_PHONE) | |
!= PackageManager.PERMISSION_GRANTED) { | |
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this, | |
Manifest.permission.CALL_PHONE)) { | |
Toast.makeText(MainActivity.this, "I know you said no, but I'm asking again", Toast.LENGTH_SHORT).show(); | |
} | |
ActivityCompat.requestPermissions(MainActivity.this, | |
new String[]{Manifest.permission.CALL_PHONE}, |