Q:

Android HashMap with simpleAdapter is not working

I want to display a very simple Key->value in Listview by using HashMap and simpleAdapter. The xml file contains 2 Textview. The reason i use Hashmap is because I need to use the "key" as reference when clicking on them and pass it to another Activity later on.
public class Main2Activity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main2);

    String[] animal_id = new String[] {
            "1",
            "2",
            "3"

    };
    String[] animal_names = new String[] {
            "mouse",
            "dragon",
            "tiger"
    };

    List<HashMap<String,String>> aList = new ArrayList<HashMap<String,String>>();

    for(int i=0;i<3;i++){
        HashMap<String, String> hm = new HashMap<String,String>();
        hm.put("ID",animal_id[i]);
        hm.put("Name",animal_names[i]);
        aList.add(hm);
    }

    String[] from = { "ID","Name"};

    int[] to = { R.id.id, R.id.name};

    SimpleAdapter adapter = new SimpleAdapter(this, aList, android.R.layout.simple_list_item_1, from, to);

    ListView listView = (ListView) findViewById(R.id.listView);
    listView.setAdapter(adapter);

}

XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.volley.Main2Activity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="id"
        android:id="@+id/id"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="name"
        android:id="@+id/name"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/listView" />
</RelativeLayout>

A:

The TextViews used in your SimpleAdapter are going to be created as needed when the given layout is inflated for the rows, so you don't need the id and name <TextView>s in your layout. We'll also change the <ListView>'s width and height to match_parent.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.volley.Main2Activity">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/listView" />

</RelativeLayout>

Then, the layout you're giving the SimpleAdapter - simple_list_item_1 - is only a single TextView, but you want to display two Strings for each item, so we'll use simple_list_item_2 instead. The TextViews in that layout have system resource IDs text1 and text2, so we need to change your to array, as well.
String[] from = { "ID", "Name" };
int[] to = { android.R.id.text1, android.R.id.text2 };

SimpleAdapter adapter = new SimpleAdapter(this, aList, android.R.layout.simple_list_item_2, from, to);

ListView listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);

Following suggestions in the comments, you already dropped the extraneous argument in the constructor call, and you're now calling setAdapter() directly on your ListView, so everything else should be good to go.

The simple_list_item_2 does stack its TextViews vertically, so if you want both on a single, horizontal line, you'll need to use your own layout. For a simple, generic example, we'll use a LinearLayout and two TextViews with weighted widths, to keep the columns aligned.
In your res/layout/ folder, list_item.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/text_id"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/text_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="4" />

</LinearLayout>

And the few changes in the code:
int[] to = { R.id.text_id, R.id.text_name };

SimpleAdapter adapter = new SimpleAdapter(this, aList, R.layout.list_item, from, to);

