请补全下面代码,实现将数据写入手机本地文件中。每空2分,共20分。 import java.util.Map; import android.annotation.SuppressLint; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity implements OnClickListener { private static final String TAG = "MainActivity"; private EditText et_username; private EditText et_pwd; private CheckBox cb_checked; private Button bt_login; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); et_username = (EditText) this.findViewById(R.id.et_username); et_pwd = (EditText) this.findViewById(R.id.et_pwd); cb_checked = (CheckBox) this.findViewById(R.id.cb_checked); bt_login = (Button) this.findViewById(R.id.bt_login); bt_login.setOnClickListener(this); Map map = FileIntoDev. 第一空2分)(this); if (map != null) { et_username.setText(第二空2分)); et_pwd.setText( ); } } @SuppressLint("ShowToast") @Override public void onClick(View v) { String userName = et_username.getText().toString().trim(); String userPwd = et_pwd.getText().toString().trim(); Log.e("onClick",userName); Log.e("onClick",userPwd); if (TextUtils.isEmpty(userName) || TextUtils.isEmpty(userPwd)) { Toast.makeText(this, "用户名为空或用户密码为空", Toast.LENGTH_SHORT).show(); } else { if (cb_checked.isChecked()) { if (FileIntoDev.saveFileUserInfo( )) { Log.i(TAG, "用戶名和密码保存成功"); Toast.makeText(this, "用戶名和密码保存成功", Toast.LENGTH_SHORT).show(); } }else { if (FileIntoDev.saveFileUserInfo(this, userName,null)) { Log.i(TAG, "用戶名保存成功"); Toast.makeText(this, "用戶名保存成功", Toast.LENGTH_SHORT).show(); } } } } } import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import android.content.Context; public class FileIntoDev { public static boolean saveFileUserInfo(Context context, String username, String Pwd) { File file = new File( , "userinfo.txt"); try { FileOutputStream userFileout = new FileOutputStream( ); userFileout.write((username + "," + Pwd).getBytes()); userFileout. ; return true; } catch (Exception e) { e.printStackTrace(); return false; } } //从文件中读取用户的信息,并保存在Map对象中 從context.getFilesDir()中获得文件目录 public static Map getUserInfo(Context context) { File file = new File(context.getFilesDir(), "userinfo.txt"); FileInputStream userFilein; try { userFilein = new FileInputStream(); BufferedReader bufferedReader = new BufferedReader( ; String str = bufferedReader.readLine(); String userinfos[] = str.split(","); Map map = new HashMap (); map.put("username", userinfos[0]); map.put("userpwd", userinfos[1]); return ; } catch (Exception e) { e.printStackTrace(); return null; } } }