Code example for AppWidgetHost

Methods: startListening

0
   
    updateLayout(); 
  
	//Here we initialize widget manager. 
    mAppWidgetManager = AppWidgetManager.getInstance(this);
    mAppWidgetHost = new AppWidgetHost(this, APPWIDGET_HOST_ID);
    mAppWidgetHost.startListening();
     
    MakeWidgets(); 
    //MAKE WIDGETS! 
    //This part is all that we need to add to the lockscreen activity 
 
} 
 
private void updateLayout() { 
    LayoutInflater inflater = LayoutInflater.from(this);
 
    setContentView(inflateView(inflater));
} 
 
//override is for when we subclass LockActivity for purpose pass the blank slate layout