@Override
public Object instantiateItem(ViewGroup container, int position) {
View v =null;
if (position == 0) {
v = mInflater.inflate(R.layout.page1, null);
high = (ImageView) v.findViewById(R.id.high);
Thread thread1 = new Thread(new Runnable() {
@Override
public void run() {
handler.postAtTime(new Runnable() {
@Override
public void run() {
count = 0;
while (true) {
if (count == 0) {
high.setImageResource(R.drawable.img1);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
} else if (count == 1) {
high.setImageResource(R.drawable.img2);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
count++;
if (count == 2) {
count = 0;
}
}
}
}, 100);
}
});
thread1.start();
container.addView(v);
pagerAdapter 코드중 일부분 입니다(조금 불편하게 써져있는건 봐주세요 ㅠㅠ)
이렇게 뷰를 추가하고 이미지를 주기적으로 바꿔주려는데 position 0 만 가면 앱이 멈춰버립니다 ㅠㅠ
thread 쪽 에서 뭔가 걸리는거 같은데 멈추면서 로그도 아예안떠서 답답하네요 ㅠㅠ
고수님들 부탁합니다!!