2014-01-23 2 views
0

위젯이 생성되거나 onEnabled되었을 때 위젯 x, y 좌표를 저장/가져 오는 방법 ?? 내 위젯 이미지 뷰에 그물이 imageViews을 추가 할 수 있기 때문에 나는 그들을 싶어 여기에 내가 내 마음을 변경하고 대신 투명 활동을 사용위젯 위치 저장

public class MyWidgetProvider extends AppWidgetProvider { 
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { 
    final int N = appWidgetIds.length; 

    for (int i=0; i<N; i++) { 
     int appWidgetId = appWidgetIds[i]; 

     Intent intent = new Intent(context, MainActivity.class); 
     PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); 

     RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget_layout); 
     views.setOnClickPendingIntent(R.id.imageView1, pendingIntent); 

     appWidgetManager.updateAppWidget(appWidgetId, views); 
    } 
} 

@Override 
public void onEnabled(Context context) { 
    // TODO Auto-generated method stub 
    super.onEnabled(context); 
    Toast.makeText(context, "Welcome to QNotes Application :)", Toast.LENGTH_LONG).show(); 
} 

@Override 
public void onReceive(Context context, Intent intent) { 
    // TODO Auto-generated method stub 
    super.onReceive(context, intent); 
    Toast.makeText(context,"asd", Toast.LENGTH_LONG).show(); 

} 

답변