Question: My code:

Added data in array adapter but last data only comming how to add all the data in spinner using arrayadapter

```
while (rs.next()) {
                int_EMP_ID = rs.getInt("EmpID");
                str_EMP_Name = rs.getString("EmployeeName");

                int User_ID_List[] = {int_EMP_ID};
                String User_name_List[] = {str_EMP_Name};

                for (int i=0;i<=10;i++) {
                    // Step 2: Create and fill an ArrayAdapter with a bunch of "State" objects
                    ArrayAdapter<Employee> spinnerArrayAdapter = new ArrayAdapter<Employee>(this, android.R.layout.simple_spinner_item, new Employee[]{
                            new Employee(User_ID_List[i], User_name_List[i]),
                            new Employee(User_ID_List[i], User_name_List[i])
                    });
                }

```

> 
> Blockquote
> 
> 
>

Answer: 
You *could* try doing a regex replacement here:

```
String input = "\"email_settings\": {\n      \"email.starttls.enable\":\"true\",\n      \"email.port\":\"111\",\n      \"email.host\":\"xxxx\",\n      \"email.auth\":\"true\",\n}";
String output = input.replaceAll("([ ]*\"email.host\":\".*?\")", "      \"email.name\":\"myTest\",\n$1");
System.out.println(output);

```

This prints:

```
"email_settings": {
      "email.starttls.enable":"true",
      "email.port":"111",
      "email.name":"myTest",
      "email.host":"xxxx",
      "email.auth":"true",
}

```

However, if you are dealing with proper JSON content, then you should consider using a JSON parser instead. Parse the JSON text into a Java POJO and then write out with the new field.
```
content = content.replace("\"email.host\":", "\"email.name\":\"myTest\",\n" + "      \"email.host\":");

```

Or you could look in to libraries which parse json files.