Implementing Search filter in Android -


suppose showing list of movies.

you offering filter (as separate activity) (filter window overlayed on top of list of movies (not sure how in android)

now user selects filters in filter screen, , wants apply filter.

the filter data should transfered filter activity previous activity (which shows movie lists).

how can pass data in scenario?

should use kind of event system (such notificationcenter in ios)? or should use form of startactivity though activity started , waiting.

  1. when want open particular activity result in previous activity, best practice according me use startactivityforresult(intent,requestcode) instead of startactivity(intent).

  2. override following method 1st activity wish receive data onactivityresult(int requestcode, int resultcode, intent data)

  3. in order result on 1st activity, following code should triggered in 2nd activity

            intent resultintent = new intent();         resultintent.putextra("data", yourdata); //make 'yourdata' serializable if pojo         setresult(activity.result_ok, resultintent);         finish(); 
  4. after code triggers callback in onactivityresult() in 1st activity called startactivityforresult() whatever extars put. hope helps. gl


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -