android - Fill a listview without calling setContentView -
I have to fill in a list with some information. My problem is that I want to fill the last one at the end of an activity.
I try to explain:
start -> Activity 1 (Layout 1) - & gt; Activity 2 (Layout 2) - & gt; End (layoutand)
Now I want to add some information to the list and I want to end it (activity). I can not setContentView for the layout of the activity, because I have set the layoutEnd that
code in the end.
@Override Public Zero OnCreate (bundled savedInstanceState) {super .onCreate (savedInstanceState); SetContentView (R.layout.training_beendet); Listview = (List View) SearchWidIlist (R.id.listview); Listview.setAdapter (New Your Adapter (This, New String [] {"Efferner 1"})); }
Layout with list view:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" Android: Layout_width = "Fill_parent" Android: Layout_height = "Fill_parent" android: orientation = "horizontal" & gt; & Lt; ListView Android: id = "@ + id / listview" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; / ListView & gt; & Lt; / LinearLayout & gt;
Layout with text for list view:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; RelativeLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" Android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" android: orientation = "horizontal" & gt; & Lt; TextView android: layout_width = "wrap_content" Android: Layout_height = "Wrap_content" android: text = "header" android: id = "@ + id / header" / & gt; & Lt; TextView android: id = "@ + id / text" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: Layout_marginLeft = "L5dp" Android: layout_toRightOf = "@ id / Header" / & gt; & Lt; / RelativeLayout & gt;
you can protect the bullion flag in the database within Sajapreman or Menaktiviti means my flag is that it starts a fresh or Then there is no reason to maintain a value.
- MainActivity the onCreate () inside the method, just check the boolean flag variable, if it launches the launch activity or activity that is fresh start.
- If it's fresh, get started and you are finally, then launch an action to launch that activity which is a list view with information.
Comments
Post a Comment