android - add bottom bar with function type onclicklistener -


I have created an XML for the bar below, along with this line of code, the other activity applies the following in xml:

  & lt; Layout = "@ layout / bottom_bar" />  

Where the bottom bar of the file xml is named bottom_bar.

I created a MainActivity and when I launch the app I see the mainActivity content with the bottom times.

How to set an onclicklistener in a button of the bottom bar and do it work in every activity of my app?

This bottom_bar.xml

   & Lt; / LinearLayout & gt; & Lt; / HorizontalScrollView & gt;  

this MainActivity.java

  the public class spreads MainActivity activity {protected Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); SetContentView (R.layout.activity_main); LayoutInflater LayoutAffler = (Layout Inflator) getApplicationContext (). GetSystemService (References LAOUT_INFLATER_SERVICE); Enter Linear Layout Point = (Linear Layout) Find VViBID (RID List View = New Arrayist); // A Dynamic View Iterator & lt; Notizia & gt; This = (Dati.listaNotizie). Viewer (); while (it Haas next ()) {final Notijia not Itknext = (); views = Leautifletrkinflat (r. Lett. Letaut_notijhi, blank); TextView textView = (TextView) view.findViewById (R. id.notizieTitolo); Int pixel = (int) (10 * getResources (). GetDisplayMetrics (). density); TextView text View1 = (TextView) view.findViewById (R.id.notizieSottoTitolo); textView.setText (not.getTitolo ()); xtView1.setText (not.getSottoTitolo ()); textView.setOnClickListener (New OnClickListener () {public void onClick (View v) {Dati.setNewsListaAttuale ( "http://www.rhinos.it/rhinos-news/"); SingleNewsActivityksetNotizia (no); intent intent = new intent (MainActivity.this, SingleNewsActivity.class); intent.setFlags (Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity (intent);}}); Dekenksetleautpar (new Leautprrm (layout para. WRAP_CONTENT, paragraph layout WRAP_CONTENT);); Views.add (see); } For (int i = 0; i & lt; views.size (); i ++) insertPoint.addView ((view) views.get (i)); }}  

Can I create a Java class or a function for the following squares and implement this class / function in MainActivity.java?

set ID

   

then

  see floor-bba_container = searchwbiid (rid.bottom_bar); Bottom_bar_container.findViewById (RID. & Lt; your id name is used inside the bottom bar & gt;);  

Set Click Listener


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -