http://www.androidpub.com/1755826

ㅠㅠ 엉엉,,, 이것때문에 잠도 못자고

오늘도 밤 샜네요..

우선 SD카드 이동 문제는 아닙니다.


위젯 등록 -> 잘 나옴

재부팅 -> 안나옴 (-_-나올때도 있음)

화면 회전 -> 그때부터 나옴 -_-;;

 

그런데 신기한게, 위젯레이아웃 뷰 두가지중 하나를

제외하면 -_-; 재부팅 하든말든 무조건 잘 나온다는겁니다.

이거 구글에 알려야되는 버그인가요..ㅠㅠ;;;


Propvider쪽 코드 입니다.

public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    // 사진 업데이트 시키기
    PFramePhotoDatabase helper = new PFramePhotoDatabase(context);
    for (int appWidgetId : appWidgetIds) {
        int[] specificAppWidget = new int[] { appWidgetId };
        RemoteViews views = buildUpdate(context, appWidgetId, helper);
        appWidgetManager.updateAppWidget(specificAppWidget, views);
    }
    helper.close();
}
//각종 런처에서는 이 메소드를 final로 선언해줘야 되더군요 -_-;;
//하지만 그렇게 하든말든 일반 홈런처에서는 안됩니다...ㅠ_ㅠ;
static RemoteViews buildUpdate(Context context, int appWidgetId, PFramePhotoDatabase helper) {
    RemoteViews views = null;
    //데이터베이스에서 사진과 액자를 불러옴,
    Bitmap bitmap_Pic = helper.getPhotoPicture(appWidgetId);
    Bitmap bitmap_Frm = helper.getPhotoFrame(appWidgetId);
    views = new RemoteViews(context.getPackageName(), R.layout.layout_widget22);

    //다음 if 문 둘중하나를 제거하면 -_-; 잘 됩니다. 왜 그럴까요...(하나는 액자, 하나는 사진)
    if (bitmap_Pic != null) {
         views.setImageViewBitmap(R.id.wiv_Picture22, bitmap_Pic); //사진 이미지뷰에 셋팅
    }
    if (bitmap_Frm != null) {
        views.setImageViewBitmap(R.id.wiv_Frame22, bitmap_Frm);  //액자 이미
    }
    return views;
}


 그래서 if문을 분리해서

아예 메소드를 두가지로 분리하면 되긴하는데

위젯 등록 즉시 액자는 나오지만 사진은 안나오는 현상이...

하지만 이렇게 하면 재부팅 해도 잘 됩니다.

 

위젯 레이아웃 XML 입니다. (layout_widget22.xml)

 <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/layout_widget22"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:padding="6dip" >

<ImageView
  android:id="@+id/wiv_Picture22"
  android:layout_width="136dip"
  android:layout_height="176dip"
  android:layout_gravity="center" />

<ImageView
  android:id="@+id/wiv_Frame22"
  android:layout_width="148dip"
  android:layout_height="188dip"
  android:layout_gravity="center" />
  <!-- 148/188 -->
</FrameLayout>

제발 도와주세요 ㅠㅠ;;;

위젯뷰가 두가지 뷰 이상을 구현 못하나요??

절대 그러지는 않을텐데요...ㅠㅠ