제가 계산기를 만들었는데 그걸 위젯으로 만들려고 합니다
바탕화면에 놓을려고요
그런데 바로는 안되고 클릭해야지 되더라구요
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds){
final int N = appWidgetIds.length;
super.onUpdate(context, appWidgetManager, appWidgetIds);
for (int i=0; i<N; i++) {
int appWidgetId = appWidgetIds[i];
RemoteViews views = new RemoteViews(context.getPackageName(), R.xml.calc_widget);
remoteViews = new RemoteViews( context.getPackageName(), R.layout.calc );
Intent intent = new Intent(context, MainActivity.class);
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_CLEAR_TASK);
remoteViews.setOnClickPendingIntent(R.id.tv1, pi);
appWidgetManager.updateAppWidget( appWidgetId, remoteViews );
}
}
클릭안하고 바로 기존에 만든 계산기를 바탕화면(위젯)에 배치할수ㅇ없나요?
방법이 없을까요?