首页 新闻 会员 周边 捐助

android开发真机测试连接pc端问题??求教

0
悬赏园豆:10 [已关闭问题] 关闭于 2013-04-02 11:44

代码如下,获取本地计算机上图片;
(Ip为192.168.1.3,模拟器中为10.0.2.2)
btn1获取本地pc端服务器端图片,btn2获取网络图片,代码相同,网络图片获取正常,pc端无法获取,logcat如图:
 public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.activity_main);
img1=(ImageView)findViewById(R.id.img1); 
    btn1=(Button)findViewById(R.id.btn1);  
    img2=(ImageView)findViewById(R.id.img2); 
    btn2=(Button)findViewById(R.id.btn2);  
        btn1.setOnClickListener(new OnClickListener(){
       @Override
        public void onClick(View v)
{
         System.out.println("本地OK");           
            new Thread(new Runnable() {
                public void run() {
                       System.out.println("本地OK!!");
                        bitmap1= new getBitmap(); 
                        final  String newurl = "http://192.168.1.3:50673/Web/upload/comm/2010-05-27/071b884b-f0b7-4937-ae6e-f37ec8273611.jpg";  
                        final Bitmap bitmap = bitmap1.getBitmap(newurl);                    //从网络获取图片                     
                        img1.post(new Runnable(){
                        public void run(){
                        img1.setImageBitmap(bitmap);
                        System.out.println("本地测验");
                        }});}}).start();
     }});
        btn2.setOnClickListener(new OnClickListener(){
          @Override
           public void onClick(View v)
    {
            System.out.println("OK");           
               new Thread(new Runnable() {
                   public void run() {
                          System.out.println("OK!!");
                           bitmap2= new getBitmap();  
                           final  String url1 ="http://img6.ph.126.net/hBiG96B8egigBULxUWcOpA==/109212290980771276.jpg";  
                           final Bitmap bitmap3 = bitmap2.getBitmap(url1);  
                          //从网络获取图片                     
                           img2.post(new Runnable(){
                           public void run(){
                           img2.setImageBitmap(bitmap3);
                           System.out.println("测验");
                           }});}}).start();
        }});}}另,两个监听在模拟其中都能正常运行

手机端设置好的静态ip,两者可以互相ping通。请教高手们可能是哪的问题?谢啦

< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册