Monday, February 17, 2014

List <Map <String,String>> The keyword search problem


Students write words recently cost, requiring a query is a query by keyword

search = (EditText) findViewById (R.id.key) ;/ / query edit box
Intent intent = getIntent () ;/ / received intent, which contains data data
Bundle data = intent.getExtras ();

/ / Retrieve data from the Bundle packet
@ SuppressWarnings ("unchecked")
List > list = (List >) data.getSerializable ("data");

Now the question is how to get the map of keywords to compare and search the String, and then find the corresponding values.

My previous code
int size = 0;
List > list1 = new ArrayList > ();

for (size = 0; size {
Set keys = list.get (size) keySet ();.
Iterator it = keys.iterator ();

if (list.get (size). get (it.next ()) == search.getText (). toString ())
{
list1.add (list.get (size));
}

}

There
/ * If (list.get (size). ContainsKey ((Object) search.getText (). ToString ()))
{

list1.add (list.get (size));

} * /

2 ways to run error, saying it was a null pointer problem. . . I am a novice
Seeking to understand map or List > How to get key.
Finally posted code<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
map stored inside what?
Reply:
Your Bundle What data is loaded
Reply:
cited a floor cclovescw reply:
map stored inside what?

MAP is kept in words and explain. 2 are acquired by another one EditText activity through.
Reply:
reference to the second floor pengguohua1988 reply:
Your Bundle installed what data


By another one activity by map loaded words and explain. Into the map array. Finally, the cursor get so intent spread of this activity
Reply:
Seems to be no way to get key issue

No comments:

Post a Comment