title: Set Key and Value in spinner
body: <p>I have a spiner and I want set a key and a value on this,I use of HashMap,It's work,but show one row,like this:</p>
  
  <p><img src="https://i.stack.imgur.com/bST5i.jpg" alt="enter image description here"></p>
  
  <p>Code:</p>
  
  <pre><code>        final View rootView = inflater.inflate(R.layout.fragment_photos, container, false);
  
      Spinner spin=(Spinner)rootView.findViewById(R.id.spinner1);
  
      HashMap&lt;Integer, String&gt; P_Hash=new HashMap&lt;Integer, String&gt;();
  
      Update Get_Information=new Update(rootView.getContext());
  
      ArrayList&lt;String&gt; Province_NAME=new ArrayList&lt;String&gt;();
      Province_NAME=Get_Information.GET_Province();
  
      ArrayList&lt;Integer&gt; Province_ID=new ArrayList&lt;Integer&gt;();
      Province_ID=Get_Information.Get_Province_ID();
  
      for (int i = 0; i &lt; Province_ID.size(); i++)
      {
          P_Hash.put(Province_ID.get(i), Province_NAME.get(i));
          Log.d("Province_ID.get(i)", Province_ID.get(i)+"");
          Log.d(" Province_NAME.get(i)",  Province_NAME.get(i)+"");
      }
  
  
      ArrayAdapter&lt;HashMap&lt;Integer, String&gt;&gt; adapter = new ArrayAdapter&lt;HashMap&lt;Integer,String&gt;&gt;(rootView.getContext(), android.R.layout.simple_spinner_item);
      adapter.add(P_Hash);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
      spin.setAdapter(adapter);
  </code></pre>