Loop and ListView

Posted by monomi on Stack Overflow See other posts from Stack Overflow or by monomi
Published on 2011-11-20T17:45:55Z Indexed on 2011/11/20 17:53 UTC
Read the original article Hit count: 205

Filed under:
|
|

I find a match with Regexp. How to correctly organize a loop, if more than one match and write it in the ListView?

listAlbums = (ListView)findViewById(R.id.listAlbums);

...

Pattern patternNameToId = Pattern.compile(kRegexp);
String nameTo = ""

Matcher matcherName = patternNameToId.matcher(response);
if (matcherName.find()) {
    nameTo = matcherTopicTitle.group(2);
    albumsList = new ArrayList<String>();
    albumsList.add(nameTo);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(context,
            android.R.layout.simple_list_item_1, albumsList);
    listAlbums.setAdapter(adapter);
} else
    Toast.makeText(context, "?? ???????", Toast.LENGTH_LONG).show();

© Stack Overflow or respective owner

Related posts about java

Related posts about android