ºÎ»ê21±â
¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 

[ ºÎ»ê21±â ½ºÅ͵ð ±×·ì]

ÀÏÀÚ : 2016³â12¿ù15ÀÏ~12¿ù27ÀÏ / ½Ã°£ : ¿ÀÈÄ 7½Ã~10½Ã (»óȲ¿¡ µû¶ó º¯µ¿µÉ ¼ö ÀÖÀ¸´Ï °øÁö Çʵ¶)
¸àƼ : ¹èÀÎȯ, °û±Ç¼·, ¼­¿¹¸²
¸àÅä : ÀÌ°æ¿ë
±³Á¦ : ÇѺû¹Ìµð¾î Android Studio¸¦ È°¿ëÇÑ ¾Èµå·ÎÀ̵å ÇÁ·Î±×·¡¹Ö (Áõº¸ÆÇ)
http://book.naver.com/bookdb/book_detail.nhn?bid=10220519
* Çʼö Áغñ¹°Àº ¾Æ´Õ´Ï´Ù. Ã¥ ³»¿ëÀ¸·Î Áøµµ ³ª°¡Áö ¾Ê½À´Ï´Ù.


°Ô½Ã¹° 10°Ç
   
[ÀÚ·á] JSONÅë½Å - MainActivity.java
±Û¾´ÀÌ : ÀÌ°æ¿ë ³¯Â¥ : 2016-02-18 (¸ñ) 16:36 Á¶È¸ : 1755
package net.apptools.jsonnetwork;

import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import util_parse.HttpParser;
import util_parse.RowData;
import util_parse.GetImage;

public class MainActivity extends AppCompatActivity {
ArrayList<RowData> arrayList;
ListView listView;
Adapter adapter;
String serverUrl = "http://study.saybox.net:8080/lky/";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
arrayList=new ArrayList<>();
HttpParser httpParser =
new HttpParser(serverUrl + "json.php");
String str = httpParser.JsonParse();
try {
JSONArray jsonArray = new JSONArray(str);
for(int i=0;i<jsonArray.length();i++){
JSONObject jsonObject=jsonArray.getJSONObject(i);
int idx = jsonObject.getInt("idx");
String category = jsonObject.getString("category");
String img = jsonObject.getString("img");
int sort = jsonObject.getInt("sort");
RowData rowData=new RowData(idx,category,img,sort);
arrayList.add(rowData);
}
} catch (JSONException e) {
e.printStackTrace();
}

listView = (ListView) findViewById(R.id.listView);
adapter = new Adapter();
listView.setAdapter(adapter);
}

class Adapter extends BaseAdapter {
@Override
public int getCount() {
return arrayList.size();
}

@Override

public Object getItem(int position) {
return position;
}
@Override

public long getItemId(int position) {
return position;
}
@Override

public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null) {
convertView = View.inflate(MainActivity.this, R.layout.listview_row, null);
}

TextView category = (TextView) convertView.findViewById(R.id.category);
category.setText(arrayList.get(position).getCategory());

TextView idx = (TextView) convertView.findViewById(R.id.idx);
idx.setText(arrayList.get(position).getIdx() + "");

ImageView imageView = (ImageView) convertView.findViewById(R.id.imageView);
String imgUrl = serverUrl + arrayList.get(position).getImg();
Bitmap bitmap = new GetImage().bitmap(imgUrl);
imageView.setImageBitmap(bitmap);
return convertView;
}
}
}


[ÀÌ °Ô½Ã¹°Àº ÀÌ°æ¿ë´Ô¿¡ ÀÇÇØ 2016-08-11 21:26:17 ºÎ»ê18±â¿¡¼­ º¹»ç µÊ]

[ÀÌ °Ô½Ã¹°Àº ÀÌ°æ¿ë´Ô¿¡ ÀÇÇØ 2016-12-22 20:52:32 ºÎ»ê20±â¿¡¼­ º¹»ç µÊ]

   

°Ô½Ã¹° 10°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
10 [ÀÚ·á]  JSONÅë½Å - json.php ÀÌ°æ¿ë 02-18 1757
9 [ÀÚ·á]  JSONÅë½Å - manifests ÀÌ°æ¿ë 02-18 1621
8 [ÀÚ·á]  JSONÅë½Å - GetImage.java ÀÌ°æ¿ë 02-18 1631
7 [ÀÚ·á]  JSONÅë½Å - HttpParser.java ÀÌ°æ¿ë 02-18 1636
6 [ÀÚ·á]  JSONÅë½Å - RowData.java ÀÌ°æ¿ë 02-18 1744
5 [ÀÚ·á]  JSONÅë½Å - MainActivity.java ÀÌ°æ¿ë 02-18 1756
4 [ÀÚ·á]  JSONÅë½Å - listview_item.xml ÀÌ°æ¿ë 02-18 1685
3 [ÀÚ·á]  JSONÅë½Å - activity_main.xml ÀÌ°æ¿ë 02-18 1748
2 [ÀÚ·á]  À¥¼Ò½º °¡Á®¿À±â ÀÌ°æ¿ë 08-11 1773
1 [°øÁö]  ¼ö¾÷ÀÚ·á ÀÌ°æ¿ë 07-16 2003
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.