2013-12-23 69 views
0

這裏我想顯示一個圖像標誌,我從一個sqlite作爲blob數據庫接收時,我沒有互聯網,但我知道它不是一個很好的做法,但我想這樣做更簡單。 我面臨的問題是我能夠在日誌中接收圖像,但是一些警告(下面​​的鏈接)即將到來,因爲它沒有將它加載到imageView中。android Blob圖像不加載

下面是我在日誌http://i.imgur.com/paZ2ew0.png中獲得的警告!

我無法弄清楚爲什麼它仍在運行DownloadImageTask這是一個異步任務,即使在線時isOnline()== false!

ImageView logo = (ImageView)findViewById(R.id.Logo); 
    Bundle extras = getIntent().getExtras(); 

    if(isOnline(this)==true); 
    { 
    String link = extras.getString("Logo1"); 
    new DownloadImageTask(logo).execute(link); 
    } 

      if(isOnline(this)==false){ 

    Log.d("offline","image"); 
    Log.d("offline",extras.getByteArray("Logo2").toString());  
    //getting these ^^ in log 

      byte[] outImage=(byte[]) extras.getByteArray("Logo2"); 
     if(outImage!=null) 
     { 
     ByteArrayInputStream imageStream = new ByteArrayInputStream(outImage); 
     Bitmap theImage = BitmapFactory.decodeStream(imageStream); 
     logo.setImageBitmap(theImage); 
     } 


    } 
    } 

回答

0
if(isOnline(this)==true)//you Superfluous add a ";" in this 
    { 
    String link = extras.getString("Logo1"); 
    new DownloadImageTask(logo).execute(link); 
    } 

我是新手,希望能幫助你

+0

什麼ü意思? – gandharv09

+0

他意味着你需要在if語句後襬脫分號。 –

+0

ooops我沒有看到這個!謝謝解決! – gandharv09