1. Nimm jetzt an unserem Uhans - 3. ADVENT - Gewinnspiel teil - Alle Informationen findest Du hier!

Spinner - switch case Problem

Dieses Thema im Forum "Android App Entwicklung" wurde erstellt von DeNiXP, 30.06.2011.

  1. DeNiXP, 30.06.2011 #1
    DeNiXP

    DeNiXP Threadstarter Neuer Benutzer

    Beiträge:
    9
    Erhaltene Danke:
    0
    Registriert seit:
    27.06.2011
    Hallo,

    ich möchte gern einem Spinner 3 verschiedene Comparatoren zuweisen über eine switch-case Anweisung.

    Kann mir bitte jemand sagen, was muss ich im Quelltext verändern, dass bei der Spinnerauswahl, einer der 3 Comperatoren durchgeführt wird?

    Danke im vorraus.


    Code:
    ....
     
    [SIZE=2][COLOR=#7f0055][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B]
    [LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] SeenAtlas [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ListActivity [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]implements[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] OnItemSelectedListener[/SIZE] {[/SIZE][/LEFT]
     
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Comparator<RSSItem> [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tComparator[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Comparator<RSSItem>() {[/SIZE]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] compare(RSSItem arg0, RSSItem arg1) {[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]String t1 = ((RSSItem) arg0).getTitle();[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]String t2 = ((RSSItem) arg1).getTitle();[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] t1.compareTo(t2); [/SIZE][/LEFT]
     
    [LEFT][SIZE=2]};[/SIZE]
    
    [SIZE=2]};[/SIZE]
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Comparator<RSSItem> [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dateComparator[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Comparator<RSSItem>() {[/SIZE][/LEFT]
    [/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] compare(RSSItem arg0, RSSItem arg1) {[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]String date1 = ((RSSItem) arg0).getPubDate();[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]String date2 = ((RSSItem) arg1).getPubDate();[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] date1.compareTo(date2);[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]};[/SIZE]
    
    [SIZE=2]};[/SIZE]
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Comparator<RSSItem> [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]desComparator[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Comparator<RSSItem>() {[/SIZE][/LEFT]
    [/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] compare(RSSItem arg0, RSSItem arg1) {[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]String des1 = ((RSSItem) arg0).getDescription();[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]String des2 = ((RSSItem) arg1).getDescription();[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] des1.compareTo(des2);[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]};[/SIZE]
    
    [SIZE=2]};[/SIZE][/LEFT]
    
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] List<RSSItem> [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE][/LEFT]
     
    [LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreate(Bundle savedInstanceState) {[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onCreate(savedInstanceState);[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]main[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
    
    [SIZE=2]loadFeed();[/SIZE][/LEFT]
    
     
    [LEFT][SIZE=2]} [/SIZE][/LEFT]
     
    [LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// XML [U]Parsen[/U][/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] loadFeed() {[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]try[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] {[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]FeedParser parser = [/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] FeedParser([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].getResources().getXml(R.xml.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]badeseenliste[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]));[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]long[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] start = System.[I]currentTimeMillis[/I]();[/SIZE][/LEFT]
     
    [LEFT][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = parser.parse();[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]long[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] duration = System.[I]currentTimeMillis[/I]() - start;[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]Log.[I]i[/I]([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"test"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Parser duration="[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + duration);[/SIZE][/LEFT]
     
     
    
    [SIZE=2][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]Spinner spinner = (Spinner) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sp_sortieren[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE][LEFT]
    [LEFT][SIZE=2]ArrayAdapter<CharSequence> adapter = ArrayAdapter.[I]createFromResource[/I]([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], R.array.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]sp_anzeige[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], android.R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]simple_spinner_item[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE]
    [SIZE=2]adapter.setDropDownViewResource(android.R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]simple_spinner_dropdown_item[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]); [/SIZE]
    [SIZE=2]spinner.setAdapter(adapter);[/SIZE][/LEFT]
     
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] List<String> titles = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ArrayList<String>([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].size());[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (RSSItem item : [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) {[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]titles.add(item.getTitle() + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"\n"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + item.getDescription() + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]" \t ("[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + item.getPubDate()+ [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]")"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE][/LEFT]
     
    [SIZE=2]}[/SIZE]
     
    [LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/LEFT]
    [/LEFT]
    [/COLOR][/SIZE][/COLOR][/SIZE][/B][LEFT][SIZE=2].setListAdapter([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] ArrayAdapter<String>([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]row[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], titles));[/SIZE]
    [LEFT][SIZE=2]ListView lv = getListView();[/SIZE]
    [SIZE=2]lv.setOnItemClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] OnItemClickListener(){[/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onItemClick(AdapterView<?> a, View v, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] position, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]long[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] id){[/SIZE][/LEFT]
     
     
    [LEFT][SIZE=2]Intent intent = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Intent(SeenAtlas.[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], Detailansicht.[/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]);[/SIZE][/LEFT]
     
     
    [LEFT][SIZE=2]intent.putExtra([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Name"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],String.[I]valueOf[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(position).getTitle()));[/SIZE]
    [SIZE=2]intent.putExtra([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Datum"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],String.[I]valueOf[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(position).getPubDate()));[/SIZE]
    [SIZE=2]intent.putExtra([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Temp"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],String.[I]valueOf[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(position).getDescription()));[/SIZE]
    [SIZE=2]intent.putExtra([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"ID"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2],String.[I]valueOf[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].get(position).getGuid()));[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]startActivity(intent); [/SIZE]
    [SIZE=2]}[/SIZE]
    [SIZE=2]});[/SIZE][/LEFT]
     
    [LEFT][SIZE=2]} [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]catch[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (Throwable t) {[/SIZE]
    [SIZE=2]Log.[I]e[/I]([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"SeenAtlas"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], t.getMessage(), t);[/SIZE]
    [SIZE=2]}[/SIZE][/LEFT]
     
    [SIZE=2]}[/SIZE]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onItemSelected(AdapterView<?> adapter, View v, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] i, [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]long[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] lng) {[/SIZE][/LEFT]
    
    
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]switch[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (i){[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] 0:[/SIZE]
    [SIZE=2]Collections.[I]sort[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tComparator[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]break[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] 1:[/SIZE]
    [SIZE=2]Collections.[I]sort[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dateComparator[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]break[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]case[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] 2: [/SIZE]
    [SIZE=2]Collections.[I]sort[/I]([/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]items[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]desComparator[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]break[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
    [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]default[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2]:[/SIZE]
    [SIZE=2]}[/SIZE]
    [SIZE=2]} [/SIZE][/LEFT]
     
    [LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onNothingSelected(AdapterView<?> parent) { [/SIZE]
    [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// Do nothing. }[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f][/LEFT]
    [/COLOR][/SIZE][SIZE=2]}[/SIZE]
     
    [LEFT][SIZE=2]}[/SIZE][/LEFT]
    
    [/LEFT]
     
    Zuletzt bearbeitet: 01.07.2011
  2. DeNiXP, 01.07.2011 #2
    DeNiXP

    DeNiXP Threadstarter Neuer Benutzer

    Beiträge:
    9
    Erhaltene Danke:
    0
    Registriert seit:
    27.06.2011
    Hallo,

    hat den keiner eine Idee wie ich dies umsetzen kann?


    MfG
     
  3. DieGoldeneMitte, 01.07.2011 #3
    DieGoldeneMitte

    DieGoldeneMitte Android-Lexikon

    Beiträge:
    1,230
    Erhaltene Danke:
    256
    Registriert seit:
    05.02.2010
    Phone:
    Nexus 5X
    Tablet:
    Nexus 7 (2013)
    Wenn ich das richtig sehe, fehlt da nach dem sort() lediglich ein notifyDataSetChanged() an den Adapter.
     

Diese Seite empfehlen