
안드로이드 스튜디오에 MSSQL DB를 연동해서 url형태로 되있는 이미지를 로딩 시킬려고 picasso 나 Glide 를 써서 이미지를 로딩 시킬려고 해봤는데 이미지가 안떠서 질문합니다. 혹시 데이터베이스 문제인가 싶어서 url을 이미지가 아닌 문자열로 나타나게 했는데 문자열로 나오더라구요.
@Override
protected void onCreate(Bundle saveInstanceState) {
super.onCreate(saveInstanceState);
setContentView(R.layout.seoulstation);
//선택된 노선 전달받기
Intent intent = getIntent();
STATION = intent.getStringExtra("STATION");
//이미지 sql문 adapter
Station_Img = (ImageView)findViewById(R.id.Station_img);// 이미지 뷰
Glide.with(this).load(Image).into(Station_Img);
//테스트 용도
list_img = new ArrayList<String>();
adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list_img);
l3 = (ListView)findViewById(R.id.l3);
l3.setAdapter(adapter2);
list = new ArrayList<String>();
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
listView = (ListView)findViewById(R.id.listView);
listView.setAdapter(adapter);
listView_1 = (ListView)findViewById(R.id.listView);
listView_1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(getApplicationContext(), Process.class);
startActivity(intent);
String ROUTE = ((TextView)view).getText().toString();
intent.putExtra("ROUTE", ROUTE);
startActivityForResult(intent,sub);
}
});
Data();
Image();
}
public void Image(){
DBConnection db = new DBConnection();
try {
String sql = "select DISTINCT STATION_IMG from route where STATION = '"+ STATION +"'";
db.connectionDB(sql);
ResultSet rs = db.connectionDB(sql);
while (rs.next()) {
adapter2.add(rs.getString("STATION_IMG")); //이건 테스트 용도
Image = rs.getString("STATION_IMG");
}
} catch (Exception e){
}finally {
try {
db.conn.close();
} catch (Exception e) {
}
}
}
}