Code example for AppWidgetHost

Methods: allocateAppWidgetId

0
	} 
	public boolean onContextItemSelected (MenuItem item){
		switch (item.getItemId())	{
		case 1: 
        	Intent i = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
        	int a = host.allocateAppWidgetId();
        	i.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, a);
        	ArrayList<AppWidgetProviderInfo> infos = new ArrayList<AppWidgetProviderInfo>();
        	i.putExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, infos);
        	startActivityForResult(i, 0);
			break; 
		case 2: 
	 
			break; 
		case 3: 
 
		} 
		return true; 
	} 
 
Connect your IDE to all the code out there  Get Codota for Java