может вопрос окажется глупым но не могу разобраться. гуглил и нигде не сказано как добавить элементы именно в listview с fragment (я новичок в java)
public class order extends Fragment {
public order() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_order, container, false);
}
}
в фрагмент перехожу так с MainActivity.java:
if (id == R.id.box) {
setTitle("Грузы");
order Order = new order();
android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.Fragment, Order).commit();
setContentView(R.layout.fragment_order);
}
fragment_order.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".order">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_listview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/selection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="22sp" />
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
class Order
иOrder prder = new Order()