The following function in my Database Manager class is throwing the error: android.os.NetworkOnMainThreadException
This function exists as a public method in a DataBaseManager class that i created which extends SQLiteOpenHelper I am guessing this is because it needs to happen in the background, but im not exactly sure how to set that up.. can someone please help
public byte[] getBlobFromURL(String url) {
        byte[] blobData = null;
        DefaultHttpClient mHttpClient = new DefaultHttpClient();  
        HttpGet mHttpGet = new HttpGet(url);  
        HttpResponse mHttpResponse;
        try {
            mHttpResponse = mHttpClient.execute(mHttpGet);
            if (mHttpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {  
            HttpEntity entity = mHttpResponse.getEntity();
            if ( entity != null) {  
             //ContentValues values = new ContentValues();  
             blobData = EntityUtils.toByteArray(entity);  
             //mContext.getContentResolver().insert(MyBaseColumn.MyTable.CONTENT_URI, values);  
            } 
        } 
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return blobData;
    }
 
     
     
     
    