Code example for RemoteViews

0
 
		int _btnAmount_new = Integer.parseInt(sp.getString("btn_amount", "5"));
		boolean layoutChanged = (_btnAmount_new != _btnAmount);
		_btnAmount = _btnAmount_new;
		if (_remoteViews == null || layoutChanged)
			_remoteViews = new RemoteViews(_context.getPackageName(), _layoutIDList[_btnAmount - 5]);
 
		if (_btnClassArray == null)
		{ 
			_btnClassArray = new ArrayList<String>();
			_btnClassArray.add(sp.getString("Button1", "ButtonFirst"));
			_btnClassArray.add(sp.getString("Button2", "ButtonSecond"));
			_btnClassArray.add(sp.getString("Button3", "ButtonThird"));
			_btnClassArray.add(sp.getString("Button4", "ButtonFourth"));
			_btnClassArray.add(sp.getString("Button5", "ButtonFifth"));
		} 
	} 
 
	// Replace java relectioin  
	private TButton getButtonByName(String name)