cmnet/cmwap访问网络

cmwap:

URL url = new URL("http://10.0.0.172/img/baidu_logo.gif");   
      HttpURLConnection conn = (HttpURLConnection) url.openConnection();   
      conn.setRequestProperty("X-Online-Host", "www.baidu.com"); //J2ME设置CMWAP代理上网 
      conn.setDoInput(true);   
      conn.connect();   
      InputStream is = conn.getInputStream();   
      bitmap = BitmapFactory.decodeStream(is);   
      is.close();  
      conn.disconnect();

 cmnet

     path= "http://www.baidu.com/img/baidu_logo.gif“;
     URL url = new URL(path);
     HttpURLConnection conn = (HttpURLConnection) url.openConnection();
     conn.connect();
     
      InputStream is = conn.getInputStream();
      bitmap = BitmapFactory.decodeStream(is);
      is.close();
      conn.disconnect(); 
 

你可能感兴趣的:(WAP)