public class Activity extends AppCompatActivity {
Calendar c = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd:MMMM:yyyy HH:mm:ss");
String strDate = sdf.format(c.getTime());
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
EscreverData();}
private void EscreverData(){
TextView datas = (TextView) findViewById(R.id.datas);
datas.append(strDate);}}
Basically what I intend is, when this activity starts, get the date and time and display this information in the TextView. However, I liked it to continue to store the old dates and not delete them every time the activity is started again. I've tried searching a bit and I think a good solution could be SharedPreferences but I do not know how to use it. Thanks if you can help me