배열에다가 간단하게 이미지와, string을 삽입하려는데 자꾸 이미지 삽입 부분에서 막히네요..
R.drawable.cursor.getString(i+1) 이렇게해도 안되고
@drawable/cursor.getString(i+1) 이렇게 해도 안되네요 ㅜ
혼자 계속 고민하다가 안되서 첫질문 올려봅니다 ㅜ
도와주셔요!
이런 일을 하고싶은 경우가 있다.
Drawable [] imgs = new Drawable[10] ;
for( int i = 0 ; i < 10 ; i++ )
{
imgs[0] = BitmapFactory.decodeResource( res, R.drawable.drawimage + i ) ; /// 요런 일을 하고싶지만 하면 안된다.
}
"패키지명 : 타입 / 리소스명", null, null
getIdentifier( "com.test:drawable/drawimage" + i, null, null ) ;"리소스명", "타입", "패키지명"getIdentifier( "drawimage" + i, "drawable", "com.test" ) ;
리소스 id값이 반드시 순서대로라고 정해진 법은 없기 때문에 위와같이 처리해야 한다.
Resources rc = getResources( ) ;
m_imgView.setImageDrawable( rc.getDrawable( rc.getIdentifier( "drawimage" + m_num , "drawable", "com.test" ) ) ) ;
옹 좋은 답변이다
으아 감사합니다.. 결과적으로 일케 해봤는데 이미지가 안뜨는 ㅠㅠ 좀더 생각해보겠습니다. 답은 감사합니다!
mi = new MyItem(rc.getIdentifier( "cursor.getString"+(i+1), "drawable", "exam.myfirst"),cursor.getString(i+1));arItem.add(mi);
로그인 유지
이런 일을 하고싶은 경우가 있다.
Drawable [] imgs = new Drawable[10] ;
for( int i = 0 ; i < 10 ; i++ )
{
imgs[0] = BitmapFactory.decodeResource( res, R.drawable.drawimage + i ) ; /// 요런 일을 하고싶지만 하면 안된다.
}
"패키지명 : 타입 / 리소스명", null, null
getIdentifier( "com.test:drawable/drawimage" + i, null, null ) ;
"리소스명", "타입", "패키지명"
getIdentifier( "drawimage" + i, "drawable", "com.test" ) ;
리소스 id값이 반드시 순서대로라고 정해진 법은 없기 때문에 위와같이 처리해야 한다.
Resources rc = getResources( ) ;
m_imgView.setImageDrawable( rc.getDrawable( rc.getIdentifier( "drawimage" + m_num , "drawable", "com.test" ) ) ) ;