The app have the time of pushing "Web Start" button.
I get now time.
SimpleDateFormat sdf = new SimpleDateFormat("yyyy' /'MM'/'dd'/ 'HH':'mm':'ss':'"); Date date = new Date();I get previous time of pushing "Web Start" button. I use SharedPreferences Class.
SharedPreferences pref = getSharedPreferences("pref", MODE_WORLD_READABLE|MODE_WORLD_WRITEABLE); String votetime = pref.getString("votetime", sdf.format(date));I preview previous time.
TextView prevvotetime = (TextView)findViewById(R.id.text1); prevvotetime.setText(votetime);If pushing "Web Start" button, I update time.
set listener.
Button votebutton = (Button)findViewById(R.id.button1); votebutton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } });I update time and save time to SharedPreferences .
SimpleDateFormat sdf = new SimpleDateFormat("yyyy' /'MM'/'dd'/ 'HH':'mm':'ss':'"); Date date = new Date(); SharedPreferences pref = getSharedPreferences("pref", MODE_WORLD_READABLE|MODE_WORLD_WRITEABLE); Editor e = pref.edit(); e.putString("votetime", sdf.format(date)); e.commit();source code is here.
apk is here.
Please suggest your android issue by twitter or mail, I would try to clear up your issue.
0 件のコメント:
コメントを投稿