失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > android电池循环 代码 android-如何为充电日志检测电池电量和状态?

android电池循环 代码 android-如何为充电日志检测电池电量和状态?

时间:2019-01-04 13:02:12

相关推荐

android电池循环 代码 android-如何为充电日志检测电池电量和状态?

我正在尝试为android中的电池进行充电记录,并且工作正常.但是问题是我无法检测到电池电量以及充电器的状态.供您参考,我是使用android的初学者,希望有人可以帮助我编写代码.

public class ListViewA extends Activity {

/**Called when the activity is first created.*/

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.listview);

ListView lv= (ListView)findViewById(R.id.listview);

// create the grid item mapping

String[] from = new String[] {"col_1", "col_2", "col_3", "col_4"};

int[] to = new int[] { R.id.item2, R.id.item3, R.id.item4, R.id.item5};

// prepare the list of all records

List> fillMaps = new ArrayList>();

DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");

//get current date time with Calendar()

Calendar cal = Calendar.ge

如果觉得《android电池循环 代码 android-如何为充电日志检测电池电量和状态?》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。