How to use key and values from a hashmap in ArrayAdapter?
<p>I have a hashmap with key, value pairs example :-</p>

<p>(msisdn,value)</p>

<p>43664xxxxxxx,2
43665xxxxxxx,3</p>

<p>now I want to display this information in a ListView but I don't know
how to feed the data to an ArrayAdapter from the Hashmap ?</p>

<p>HERE IS MY ADAPTER, note I want to replace myList with data from the
Hashmap a concatentated key+value.</p>

<ol>
<li><p>Pass the above hashmap to the adapter, replacing myList with the
hashmap</p>

<p><CODE>
    adapter=new
    ArrayAdapter(this,android.R.layout.simple_list_item_1,myList);
    setListAdapter(adapter);
</CODE></p></li>
</ol>

<p>thanks</p>

<p>Without HASHMAP </p>

<pre><code>&lt;CODE&gt;
packagelistmodified.org;

importjava.util.Arrays;
importjava.util.ArrayList;
importjava.util.HashMap;
importjava.util.List;
importjava.util.Map;

importandroid.app.ListActivity;
importandroid.os.Bundle;
importandroid.os.Handler;
importandroid.os.Message;
importandroid.view.View;
importandroid.widget.AdapterView;
importandroid.widget.ArrayAdapter;
importandroid.widget.ListView;
importandroid.widget.TextView;
importandroid.widget.AdapterView.OnItemLongClickListener;
importandroid.view.GestureDetector.OnGestureListener;
importandroid.view.GestureDetector;
importandroid.view.MotionEvent;
importandroid.widget.Toast;




publicclasslistmodifiedextendsListActivityimplements
OnGestureListener{
publicArrayList&lt;String&gt;myList=new
ArrayList&lt;String&gt;(Arrays.asList(items));
privateTextViewselection;//MAIN.xml
publicArrayAdapter&lt;String&gt;adapter;//myadapter
publicOnItemLongClickListeneritemDelListener;
privateGestureDetectorgestureScanner;
publicintlongClickedItem=0;//checkiflongClickisselectedor
not
privateStringitemSelected;//fordeletefunction
privatestaticfinalbyteUPDATE_LIST=100;
publicAdapterView&lt;?&gt;parent;//usedbyOnLitemLongClickListener
publicintposition;

//tieitemstoanarraylistcalledmyList
publicstaticString[]items={"lorem","ipsum","dolor",
"sit","amet",
"consectetuer","adipiscing","elit","morbi","vel",
"ligula","vitae","arcu","aliquet","mollis",
"etiam","vel","erat","placerat","ante",
"porttitor","sodales","pellentesque","augue","purus"};









@Override
publicvoidonCreate(Bundleicicle){
super.onCreate(icicle);

OnItemLongClickListeneritemDelListener=new
OnItemLongClickListener(){

//@Override
publicbooleanonItemLongClick(AdapterView&lt;?&gt;parent,Viewarg1,
intposition,longarg3){
//TODOAuto-generatedmethodstub
itemSelected=parent.getItemAtPosition(position).toString();
adapter.remove(itemSelected);
Toast.makeText(listmodified.this,"positionis:"+position,
Toast.LENGTH_SHORT).show();
myList.remove(this);//removethecurrentobject,positionthrows
anexception
adapter.notifyDataSetChanged();


returnfalse;
}};

setContentView(R.layout.main);


//DEFINEMYOWNVIEWTIETOARRAYLISTmyListWHICHCONTAINSSTRINGS
adapter=new
ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,myList);
setListAdapter(adapter);

//AVIEWOFTHELISTNECESSARYFORDELETION

selection=(TextView)findViewById(R.id.selection);


//PARTOFLONGCLICKSELECTEDCODE
//CALLSIMPLEMENTEDMETHODS-detectgesturescheckingmylistitems
gestureScanner=newGestureDetector(this);
getListView().setOnTouchListener(newView.OnTouchListener(){
@Override
publicbooleanonTouch(Viewv,MotionEventevent){
returngestureScanner.onTouchEvent(event);
}
});

//UPDATEVIEWDELETEWHENONLONGCLICKISPRESSED
getListView().setOnItemLongClickListener(itemDelListener);

}


//LISTITEMPRESSCHECKING
publicvoidonListItemClick(ListViewparent,Viewv,
intposition,longid){
selection.setText(myList.get(position));
//checktoseeifLONGCLICKISPRESSED
if(longClickedItem!=-1){
Toast.makeText(listmodified.this,"Ashortclickdetected",
Toast.LENGTH_SHORT).show();

}
longClickedItem=0;
}

//IMPLEMENTEDBYGESTURE
@Override
publicbooleanonDown(MotionEventarg0){
//TODOAuto-generatedmethodstub
returnfalse;
}


@Override
publicbooleanonFling(MotionEvente1,MotionEvente2,float
velocityX,
floatvelocityY){
//TODOAuto-generatedmethodstub
returnfalse;
}


//CHECKSONLONGPRESSEVENTSSETLONGPRESSTO-1,
//COOLICANUSETHISTOSEEIFALONGCLICKWASSELECTEDLATERON

@Override
publicvoidonLongPress(MotionEvente){
//TODOAuto-generatedmethodstub
Toast.makeText(listmodified.this,"Alongclickdetected",
Toast.LENGTH_SHORT).show();


if(e.getAction()==MotionEvent.ACTION_DOWN)
{

longClickedItem=-1;

}

}


@Override
publicbooleanonScroll(MotionEvente1,MotionEvente2,float
distanceX,
floatdistanceY){
//TODOAuto-generatedmethodstub
returnfalse;
}


@Override
publicvoidonShowPress(MotionEvente){
//TODOAuto-generatedmethodstub

}


@Override
publicbooleanonSingleTapUp(MotionEvente){
//TODOAuto-generatedmethodstub
returnfalse;
}
privateHandlerupdateListHandler=newHandler(){
@Override
publicvoidhandleMessage(Messagemsg){
switch(msg.what){
caseUPDATE_LIST:
intposition=msg.arg1;
myList.remove(position);
adapter.notifyDataSetChanged();
Toast.makeText(listmodified.this,"OnSingleTapUp",
Toast.LENGTH_SHORT).show();
break;

}
;
};
};


}
&lt;/CODE&gt;
</code></pre>
