0
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);}}
Here’s my code, but, as you can see, the only thing it does is it presents, in Textview, the date of entry, of that moment, into activity. What I really wanted was to present in Textview the last 5 dates of entry into the activity, without disappearing, when I left the application, that is, store them in a list... If anyone can help me, I’d appreciate it
Use Sharedpreferences: https://developer.android.com/training/basics/data-storage/shared-preferences.html?hl=pt-br
– Márcio Oliveira