Android小记

xiaoxiao2021-02-28  87

1.模仿HOME键功能

Intent i= new Intent(Intent.ACTION_MAIN); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addCategory(Intent.CATEGORY_HOME); startActivity(i);

2.TextView中存取StringBuffer类型数据

TextView textView = findViewById(R.id.text);

StringBuffer a = new StringBuffer();

a.append("你好啊");

存:textView.setText(a);

取:String result = textView.getText().toString().trim();----Wrong

       String  result = (String)textView.getText();-----OK

转载请注明原文地址: https://www.6miu.com/read-49705.html

最新回复(0)