目前分類:未分類文章 (4)

瀏覽方式: 標題列表 簡短摘要

Your problem is similar to one CommonWare's blog. Multiple-View ViewPager Options There are three approach. One of those is override getPageWidth() in your PagerAdapter:

@Overridepublicfloat getPageWidth(int position){return(0.5f);}

The others is more complicated but there're attach source and long explanation so i don't copy here.

resource url : http://stackoverflow.com/questions/13194666/how-to-set-viewpager-size

文章標籤

techdrew 發表在 痞客邦 留言(0) 人氣()

public static void Update() throws Exception {
    HttpClient httpclient = new DefaultHttpClient();
    httpclient.getParams().setParameter(
    CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
    
    HttpPost httppost = new HttpPost("http://mpss.csce.uark.edu/~tsumar/test/upload_file.php");
    File file = new File("image.jpg");
    
    MultipartEntity mpEntity = new MultipartEntity();
    ContentBody cbFile = new FileBody(file, "image/jpeg");
    mpEntity.addPart("file", cbFile);
    
    httppost.setEntity(mpEntity);
    System.out.println("executing request " + httppost.getRequestLine());
    HttpResponse response = httpclient.execute(httppost);
    HttpEntity resEntity = response.getEntity();
    
    System.out.println(response.getStatusLine());
    if (resEntity != null) {
        System.out.println(EntityUtils.toString(resEntity));
    }
    if (resEntity != null) {
        resEntity.consumeContent();
    }
    
    httpclient.getConnectionManager().shutdown();
}
 
   
文章標籤

techdrew 發表在 痞客邦 留言(0) 人氣()

Image image = null;
try 
    URL url = new URL("http://www.yahoo.com/image_to_read.jpg");
    image = ImageIO.read(url);
} catch (IOException e) {
}

See javax.imageio package for more info. That’s using the AWT image. Otherwise you could do:

 URL url = new URL("http://www.yahoo.com/image_to_read.jpg");
InputStream in = new BufferedInputStream(url.openStream());
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int n = 0;
while (-1!=(n=in.read(buf)))
{
   out.write(buf, 0, n);
}
out.close();
in.close();
byte[] response = out.toByteArray();

And you may then want to save the image so do:

 

 

FileOutputStream fos = new FileOutputStream("C://borrowed_image.jpg");
    fos.write(response);
    fos.close();
文章標籤

techdrew 發表在 痞客邦 留言(0) 人氣()

不知道有沒有人也跟我一樣覺得 windows 7 的系統音效很煩人

每次按下一個鍵就有聲音

常常開機會被超大聲的開機音效嚇到

其實要關閉系統音效很簡單,只需要幾個步驟

比較簡單的步驟只要開啟右下角的音量控制

打開混音器

b1

把系統音響設置為靜音

b2

基本上這樣就可以關閉大部分的系統音效

但是我設定成這樣後,每次開機還是會聽到開機的系統音效

像我常常帶電去上課,開機的時候都會發出聲音,實在是非常得丟臉

另一個方法可以完全的把系統音效關閉

首先在桌面上點右鍵

選取"個人化"

b3

進入後選取"音效"

b4

把"播放系統音效"的選擇取消

b5

這樣就可以完整的把windows7的系統音效關閉了!!

techdrew 發表在 痞客邦 留言(2) 人氣()