펌 OK (출처 표시), 상업적 이용 NO, 컨텐츠 변경 NO




Study_ListView.zip


리스트뷰를 텍스트2개 , 이미지뷰1개로 커스텀 하여 출력한 예제입니다.


소스 돌려보시고 궁금한점 있으면 댓글 주세요 


요즘 일이 바빠서 자세히 포스팅을 못하고 예제만 올리네요 ..



Android/소스코드 | Posted by 덩치 2014. 2. 20. 09:07

XmlPullParser 사용하기

펌 OK (출처 표시), 상업적 이용 NO, 컨텐츠 변경 NO



Study_Parsing.zip


한경닷컴 뉴스 rss페이지를 파싱하여 출력하는 예제


퍼미션은 android.permission.INTERNET


예제를 실행시켜보고 소스를 뜯어보고


이해 안가는부분은 질문 주세요




펌 OK (출처 표시), 상업적 이용 NO, 컨텐츠 변경 NO

Display dis = ((WindowManager)getSystemService(WINDOW_SERVICE)).getDefaultDisplay();

int x = dis.getWidth();

int y = dis.getHeight();


이렇게 하면 디바이스의 가로,세로 길이가 나온다. 단위는 픽셀

펌 OK (출처 표시), 상업적 이용 NO, 컨텐츠 변경 NO

public static byte[] shortToByte(short a) {

byte[] shortToByte = new byte[2];

shortToByte[0] |= (byte)((a & 0xFF00) >>> 8);

shortToByte[1] |= (byte)(a & 0xFF & 0xff);

return shortToByte;

}  

   public static byte[] intToByte(int a) {  

     byte[] intToByte = new byte[4];     

     intToByte[0] |= (byte)((a&0xFF000000)>>24);     

     intToByte[1] |= (byte)((a&0xFF0000)>>16);     

     intToByte[2] |= (byte)((a&0xFF00)>>8);     

     intToByte[3] |= (byte)(a&0xFF);   

     return intToByte;  

   }  


-끝-

펌 OK (출처 표시), 상업적 이용 NO, 컨텐츠 변경 NO

퍼미션은 INTERNET



public void DataSend() {

try{

url = new URI("http://192.168.0.20:8080/testWebapp/Receive.jsp");

new Thread() {

public void run() {

try {

HttpClient httpclient = new DefaultHttpClient();

HttpPost httpPost = new HttpPost(url);

ArrayList<BasicNameValuePair> nameValuePairs = new ArrayList<BasicNameValuePair>();

nameValuePairs.add(new BasicNameValuePair("mark_id", sendMarkId));

nameValuePairs.add(new BasicNameValuePair("store_name", sendName));

nameValuePairs.add(new BasicNameValuePair("latitude", sendLat));

nameValuePairs.add(new BasicNameValuePair("longitude", sendLng));

nameValuePairs.add(new BasicNameValuePair("comments", sendTip));

nameValuePairs.add(new BasicNameValuePair("kind", sendKind));

httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "utf-8"));

httpclient.execute(httpPost);

} catch (Exception e) {

e.printStackTrace();

}

}

}.start();

}catch(Exception e){

Log.e("fureun",e.toString());

}

}