搜尋此網誌

2012年1月4日

Code snippet of Android (Hashtable, Enumeration)

public class MyTemplateActivity extends Activity {

     private String streamingHTTPURL1 = "https://sites.google.com/site/xxx/1.mp4";
     private String streamingHTTPURL2 = "http://indiespectrum.com:9000/";
     private String streamingRTSPURL = "rtsp://wow.eleden.com:1935/livegntv/livestream";
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        Hashtable<String, String> playTable = new Hashtable<String, String>();
       
        playTable.put("Playlist1", streamingHTTPURL1);
        playTable.put("Playlist2", streamingHTTPURL2);
        playTable.put("Playlist3", streamingRTSPURL);
        
        Enumeration<String> em = playTable.keys();
        while(em.hasMoreElements()) {
          String value = (String) em.nextElement();
          Log.w("test","" + playTable.get(value));
        }
       
        Log.w("test","Done!!");      
     }
}

沒有留言:

張貼留言