What am trying to achieve is when a user clicks on widget it should take the user to the details of that particular task which is displayed on widget. I tried with following code but nothing is happening when clicking on widget. The details class(MasterList.class) requires data which needed to fetch from network. how do i achieve this ?
Can i call network for data object from widget onUpdate(). Is this a bad practice ?
Why there is no change nor errors in logcat ? Why app is not launching ??
Did i made any blunder ??
enter code here
@Override public void onUpdate(Context context,AppWidgetManager appWidgetManager,int[] appWidgetIds) { super.onUpdate(context, appWidgetManager, appWidgetIds); Intent i = new Intent(context, CallNetwork.class); i.setAction(ACTION); context.startService(i); // starting service to get data from network Intent intent = new Intent(context, MasterListClass.class); while(CallNetwork.list.size()==0||CallNetwork.list.equals(null) //waiting for network call to complete { }if (CallNetwork.get(0).getName() != null) { this.list = CallNetwork.list;// getting data from network } intent.putExtra(context.getString(R.string.object),list.get(0)); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.recipe_widget); views.setOnClickPendingIntent(R.id.widget_layout, pendingIntent); appWidgetManager.updateAppWidget(appWidgetIds[0], views);}