You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
package com.example.test.fragment;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ListView;
|
|
|
|
import com.example.test.R;
|
|
import com.example.test.activity.fruitFragment;
|
|
import com.example.test.adapter.fruitContentAdapter;
|
|
import com.example.test.entity.fruitContent;
|
|
|
|
import java.nio.file.NotLinkException;
|
|
import java.util.List;
|
|
|
|
|
|
public class fruitContentFragment extends Fragment {
|
|
private View view;
|
|
|
|
@Override
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
Bundle savedInstanceState) {
|
|
// Inflate the layout for this fragment
|
|
view= inflater.inflate(R.layout.fragment_fruit_content, container, false);
|
|
fruitFragment activity=(fruitFragment)getActivity();
|
|
List<fruitContent[]> fruitContents = activity.getFruitContents();
|
|
show(fruitContents.get(0));
|
|
return view;
|
|
}
|
|
public void show(fruitContent fruitContents[]){
|
|
ListView listView = view.findViewById(R.id.fruit_content_listview);
|
|
listView.setDivider(null);
|
|
fruitContentAdapter adapter = new fruitContentAdapter(fruitContents,getActivity());
|
|
listView.setAdapter(adapter);
|
|
}
|
|
} |