title: Refresh Recycle view on data changes in Kivy
body: <p>Refresh of recycle view is not changed/updated on updating data from another class.
  I have seen multiple posts on this stackoverflow, but none of them are clear.</p>
  <p>I need to refresh the recycle view every time, when the button 'nextscreen' is clicked.</p>
  <p>Also provide a clear example to use the refresh_from_data() method and to which class it belongs to.
  Thanks in Advance.</p>
  <pre><code>
  import kivy
  import sys
  from kivy.app import App
  from kivy.lang import Builder
  from kivy.uix.label import Label
  from kivy.uix.gridlayout import GridLayout
  from kivy.uix.textinput import TextInput
  from kivy.uix.button import Button
  from kivy.uix.screenmanager import ScreenManager,Screen,SlideTransition,FadeTransition  
  from kivy.properties import ObjectProperty, NumericProperty, BooleanProperty,ListProperty,StringProperty
  from kivy.uix.button import Button
  from kivy.base import runTouchApp
  from kivy.uix.behaviors import FocusBehavior
  from kivy.uix.recycleboxlayout import RecycleBoxLayout
  from kivy.uix.recycleview import RecycleView
  from kivy.uix.recycleview.layout import LayoutSelectionBehavior
  from kivy.uix.recycleview.views import RecycleDataViewBehavior
  
  
  kv='''
  ScreenManagement:
      id:screenmgr
      
      Screen1:
          id:scr1
          name:'scr1'
          manager:screenmgr
      Screen2:
          id:scr2
          name:'scr2'
          manager:screenmgr
  
  &lt;Screen1&gt;:
      GridLayout:
          cols:3
          Label:
              text: &quot;Enter any no.&quot;
          TextInput:
              multiline:False
              id:newno
          Button:
              text: 'Submit'
              on_press: root.getinput(newno.text)
          Button:
              text:'nextscreen'
              on_press:root.refreshview()
              on_release:root.manager.current = 'scr2'
  
  &lt;RecycleViewlist&gt;:
      viewclass: 'SelectableLabel'
      SelectableRecycleBoxLayout:
          default_size: None, dp(56)
          default_size_hint: 1, None
          size_hint_y: None
          height: self.minimum_height
          orientation: 'vertical'
          multiselect: True
  
  &lt;Screen2&gt;:
      BoxLayout:
          listp:rv_list
          orientation:'vertical'
          Button:
              text:'Back'
              size:150,50
              on_press:app.root.current = 'scr1'
          Recycleviewlist:
              id: rv_list
  
  '''
  
  mylistno = 5
  class Screen1(Screen):
      #newnumber =StringProperty()
      mylistnew = 0
      def getinput(self,number):
          self.mylistnew = int(number)
      def refreshview(self):
          if self.mylistnew != 0:
              print('refreshed new',self.mylistnew)
              rvobj.createview(self.mylistnew)
  class Screen2(Screen):
      pass
  class Recycleviewlist(RecycleView):
      def __init__(self,**kwargs):
          super(Recycleviewlist, self).__init__(**kwargs)
          self.data = [{'text': str(x)} for x in range(mylistno)]
      
      def createview(self,mylistnonew):
          self.data = [{'text': str(x)} for x in range(mylistnonew)]
  rvobj = Recycleviewlist()
  
  class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior,
                                   RecycleBoxLayout):
      ''' Adds selection and focus behaviour to the view. '''
      
  class SelectableLabel(RecycleDataViewBehavior, Label):
      ''' Add selection support to the Label '''
      index = None
      selected = BooleanProperty(False)
      selectable = BooleanProperty(True)
      #sc3 = Screen3()
  
      def refresh_view_attrs(self, rv, index, data):
          ''' Catch and handle the view changes '''
          self.index = index
          return super(SelectableLabel, self).refresh_view_attrs(
              rv, index, data)
  
      def on_touch_down(self, touch):
          ''' Add selection on touch down '''
          if super(SelectableLabel, self).on_touch_down(touch):
              return Truej
          if self.collide_point(*touch.pos) and self.selectable:
              return self.parent.select_with_touch(self.index, touch)
  
      def apply_selection(self, rv, index, is_selected):
          ''' Respond to the selection of items in the view. '''
          self.selected = is_selected
  
  
  class ScreenManagement(ScreenManager):
      pass
  
  presentation = Builder.load_string(kv)
          
  class TestApp(App):
          
          def build(self):
                  return presentation
  
  if __name__ == '__main__':
      TestApp().run()                
  
  </code></pre>