안드로이드 개발 질문/답변
(글 수 45,052)
private void sendData(String bkna) throws ClientProtocolException, IOException { // TODO Auto-generated method stub HttpPost request = makeHttpPost(bkna, "http://burningroid.cafe24.com/index.php"); HttpClient client = new DefaultHttpClient();
ResponseHandler<String> reshandler = new BasicResponseHandler();
cube1 = client.execute(request, reshandler).split(":"); int j = 0; j = cube1.length;
cube = new String[j][]; item = new String[j]; // Toast.makeText(this,j,Toast.LENGTH_SHORT).show();
for (int i = 0; i < j; i++) { cube[i] = cube1[i].split(","); item[i] = cube[i][2];
}
// Device(result);
}
/*private void Device(String result) { // TODO Auto-generated method stub int j = 0;
cube1 = result.split(":"); j = cube1.length;
cube = new String[j][]; item = new String[j]; // Toast.makeText(this,j,Toast.LENGTH_SHORT).show();
for (int i = 0; i < j; i++) { cube[i] = cube1[i].split(","); item[i] = cube[i][2];
}
} */ private HttpPost makeHttpPost(String $bkna, String $url) { // TODO Auto-generated method stub HttpPost request = new HttpPost($url); Vector<NameValuePair> nameValue = new Vector<NameValuePair>(); nameValue.add(new BasicNameValuePair("bkna", $bkna)); request.setEntity(makeEntity(nameValue)); return request; }
private HttpEntity makeEntity(Vector<NameValuePair> $nameValue) { HttpEntity result = null; try { result = new UrlEncodedFormEntity($nameValue); } catch (UnsupportedEncodingException e) { Log.i("json2 : ", e.getMessage()); // Toast.makeText(this,"여기2",Toast.LENGTH_LONG).show();
} return result; } }
1.
인터넷 연결 소스 가 이렇게 됩니다.
웹으로 문자를 보낼때 한글시 전송이 안되고 전송 받을때 역시 한글은 전부다 깨져서 나옵니다;;
또한 전송할때 a 라고 만 입력을 하면 결과 값이 오긴하는데
어레이 바운드 입셥센이 나옵니다;;
2.
String iurl = "http://burningroid.cafe24.com/image/"+ar[0]+".png";
try{
URL url = new URL("iurl);
URLConnection conn = url.openConnection();
conn.connect();
BufferedInputStream bis = new BufferedInputStream(conn.getInputStream(),150 *200);
bm = BitmapFactory.decodeStream(bis);
bis.close();
}catch(Exception e){}
Toast.makeText(this, iurl, Toast.LENGTH_SHORT).show();
인턴트로 두번째 화면으로 넘겨 온 상황인데 url을 직접 주면 이미지가 나오나
위처럼 중간에 변수를 섞으면 이미지가 안날라 옵니다;;
토스트 메시지 확인한결과 주소는 특별한 이상은 없는것처럼 나옵니다;;
이두가지 질문좀 드릴게요;;ㅠㅠ