Am creating a master/detail fragment from this link. This works fine, now here instead of textview in detail fragment class i would like to implement listviews, (ie) i would like to display the details of the masterview as a child listview, hence i tried
detail.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:layout_width="120dp"
android:layout_height="wrap_content"
android:id="#+id/listview1"
/>"
<ListView
android:layout_width="120dp"
android:layout_height="wrap_content"
android:id="#+id/listview2"
/>"
</LinearLayout>
and in my detailFragment class
public class DetailFragment1 extends ListFragment {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String[] values = new String[] { "1", "2", "3",
"4" };
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, values);
setListAdapter(adapter);
}
My problem is child listview is displaying at initial stage but i want to display this listview when i click the first row of master page.Am new to fragments, so help me in achieving this. Thanks in advance..
Create a CallBack interface:
public interface Callbacks {
public void onItemSelected(long id);
}
Let the fragment inplement it:
public class DetailFragment1 extends ListFragment implements CallBacks {
In the ListFragment OnListitemClick:
#Override
public void onListItemClick(ListView listView, View view, int position, long id) {
mCallbacks.onItemSelected(id);
}
In the Activity:
Public class MyActivity extends FragmentActivity implements Callbacks {
#Override
public void onItemSelected(long id) {
// Replace the detail fragment with the corresponding item selected in the list
}
Instead of doing like this, you can design a layout which contains ListView as master and frameLayout container. In frameLayout container, you can dynamically inflate layout, which is designed in such a way that you can have child listview and details view.
<LinearLayout 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"
android:orientation="horizontal"
tools:context=".NavigationActivity" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="#color/strip_background"
android:layout_weight="1"
android:orientation="vertical" >
<ListView
android:id="#+id/nav_lv_transactions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
</ListView>
</LinearLayout>
<FrameLayout
android:id="#+id/nav_fl_frag_container"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:background="#android:color/darker_gray" >
</FrameLayout>
</LinearLayout>
In onclick listerner put this code,
Bundle arguments = new Bundle();
arguments.putString(ARG_ITEM_ID,
"Some Name");
MyClassFragment newFragment = new MyClassFragment();
newFragment.setArguments(arguments);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.nav_fl_frag_container, newFragment);
transaction.commit();
Try this. It will work
Related
I'm trying to add and show a multiple image views existing in a fragment to another in the same activity by OnItemClickListener on GridView.
I was able to add the first image view but when I add the second one the app crashes.
By the way, I'm adding the image views to a linear layout inside Horizontal Scroll View.
Here is the layout of the first fragment:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/content_fragment_id"
>
<GridView
android:id="#+id/items_id_gridView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:columnWidth="100dp"
android:minHeight="40dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:numColumns="auto_fit"
android:horizontalSpacing="10.0dip"
android:verticalSpacing="10.0dip"
android:cacheColorHint="#00000000"
android:gravity="center_horizontal"
android:requiresFadingEdge="vertical"
/>
</RelativeLayout>
The layout of the second fragment:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageButton
android:id="#+id/play_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/play_36dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:contentDescription="#string/play_button" />
<HorizontalScrollView
android:id="#+id/sentenceBarScrollView"
android:layout_width="fill_parent"
android:layout_height="104dp"
android:layout_toLeftOf="#id/play_button"
android:layout_toStartOf="#id/play_button"
android:padding="1dp"
>
<LinearLayout
android:id="#+id/sentence_bar"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="2dp"
android:orientation="horizontal"
>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
The layout of the main activity:
<android.support.constraint.ConstraintLayout
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=".Home"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="#+id/sentence_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical">
<fragment
android:id="#+id/sentenceBarFragment"
android:name="ye.com.ebra.contentfragments.SentenceBarFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<RelativeLayout
android:id="#+id/content_Layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/sentence_layout"
android:padding="5dp"
>
<!-- put contents fragments here :) -->
</RelativeLayout>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>
the class of the first fragment.
sendItemToSentenceBar connector;
//for retrieving the values of the image stored in database
private Item item;
static ArrayList<Integer> back;
#Override
public void onActivityCreated(#Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
back=new ArrayList<>();
DBConnection dbConnection= new DBConnection(getActivity());
GridView gridView=getActivity().findViewById(R.id.items_id_gridView);
final ArrayList<Item> items2=new ArrayList<>(dbConnection.getAll(Cat_id));
ContentAdapter dataAdapter=new ContentAdapter(getActivity(),items2);
gridView.setAdapter(dataAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
item=items2.get(position);
if(item.getType().equals("Category"))
{
back.add(Cat_id);
changeFragment(item.getID());
AddNewDialogFragment.Cat_id=item.getID();
}else {
speak(item.getName());
connector.sendData(item);
}
}
});
}
and I'm using an interface to pass the data from OnItemClickListener to the other fragment by "connector.sendData(item);"
Here is the interface:
public interface sendItemToSentenceBar {
// send item to the sentence bar fragment :)
void sendData(Item item);
}
Then in the class of the other fragment
There is the method AddItem(Item item) that should add the image view to the second fragment, the first image view can be added be on the second one the app just crashes :
private ArrayList<Item> items;
private LinearLayout sentenceLayout;
private View itemView;
private ArrayList<View> itemsViews;
View view;
#Nullable
#Override
public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, Bundle savedInstanceState) {
View sentenceBarFragment=inflater.inflate(R.layout.activity_sentence_bar_fragment,container,false);
sentenceLayout = sentenceBarFragment.findViewById(R.id.sentence_bar);
itemView = inflater.inflate(R.layout.activity_item,sentenceLayout,false);
return sentenceBarFragment;
}
public void AddItem(Item item){
TextView name_id = itemView.findViewById(R.id.name_id);
name_id.setText(item.getName());
ImageView image_id = itemView.findViewById(R.id.image_id);
image_id.setImageBitmap(convertByteToBitmap(item.getImage()));
itemsViews.add(itemView);
sentenceLayout.addView(itemsViews.get(0));
items.add(item);
}
Finally the method AddItem(Item item) is used in the class of the main activity that contain both of the fragments:
#Override
public void sendData(Item item) {
FragmentManager fragmentManager=getFragmentManager();
SentenceBarFragment s= (SentenceBarFragment) fragmentManager.findFragmentById(R.id.sentenceBarFragment);
s.AddItem(item);
}
Here the Logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:3378)
at android.view.ViewGroup.addView(ViewGroup.java:3249)
at android.view.ViewGroup.addView(ViewGroup.java:3194)
at android.view.ViewGroup.addView(ViewGroup.java:3170)
at ye.com.ebra.contentfragments.SentenceBarFragment.AddItem(SentenceBarFragment.java:95)
at ye.com.ebra.contentfragments.Home.sendData(Home.java:129)
at ye.com.ebra.contentfragments.ContentFragment$2.onItemClick(ContentFragment.java:83)
at android.widget.AdapterView.performItemClick(AdapterView.java:298)
at android.widget.AbsListView.performItemClick(AbsListView.java:1086)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:2855)
at android.widget.AbsListView$1.run(AbsListView.java:3529)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
of the Logcat, I could identify those errors:
at ye.com.ebra.contentfragments.SentenceBarFragment.AddItem(SentenceBarFragment.java:95)
which is at the class of the second fragment, in the method AddItem(Item item)
sentenceLayout.addView(itemsViews.get(0));
.
at ye.com.ebra.contentfragments.Home.sendData(Home.java:129)
which is at the class of the main activity, in the used method
sendData(Item item)
s.AddItem(item);
.
at ye.com.ebra.contentfragments.ContentFragment$2.onItemClick(ContentFragment.java:83)
which is in the class of the first fragment, in OnItemClickListener:
connector.sendData(item);
Sorry for the long post, but I'm really stuck here
You appear to be repeatedly modifying and adding the same item_view object inflated in onCreateView(...) method. It strikes me that you need to inflate a new object each time you call "AddItem".
There is also a possible issue with appending views to the itemViews list but repeatedly adding the first view in the list (ie. not the one you just added) .
So SentenceBarFragment might look instead like this:
private ArrayList<Item> items;
private LinearLayout sentenceLayout;
private ArrayList<View> itemsViews;
#Nullable
#Override public View onCreateView(LayoutInflater inflater, #Nullable ViewGroup container, Bundle savedInstanceState) {
View sentenceBarFragment=inflater.inflate(R.layout.activity_sentence_bar_fragment,container,false);
sentenceLayout = sentenceBarFragment.findViewById(R.id.sentence_bar);
return sentenceBarFragment;
}
public void AddItem(Item item){
// inflate a new view to be added
View itemView = LayoutInflater.from(getActivity()).inflate(R.layout.activity_item,sentenceLayout,false);
TextView name_id = itemView.findViewById(R.id.name_id);
name_id.setText(item.getName());
ImageView image_id = itemView.findViewById(R.id.image_id);
image_id.setImageBitmap(convertByteToBitmap(item.getImage()));
// add the view you just inflated
itemsViews.add(itemView);
sentenceLayout.addView(itemView); // or addView(itemViews.get(itemViews.size()-1))
items.add(item);
}
in my app i have a ViewPager with pages where each of them show a list. when i started i directly added the ListFragement to the ViewPager. in order to change the layout of each page (for example adding a ViewText below each list) i later created a fragement with an own layout file that contains this listFragement, which i add to the ViewPager
this is how this layout (for each page looks)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/tab_history"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/tab_fragment"
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1" >
</FrameLayout>
<LinearLayout
android:id="#+id/message_canvas"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/lightgreen"
android:orientation="horizontal"
android:paddingBottom="6sp"
android:paddingTop="6sp"
android:visibility="visible" >
<TextView
android:id="#+id/message"
android:layout_width="0sp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:contentDescription="#string/emptyString"
android:gravity="center_horizontal"
android:text="#string/emptyString"
android:textAlignment="center"
android:textColor="#color/green"
android:textStyle="bold" />
</LinearLayout>
this is the layout for the ViewPager
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/main_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:orientation="horizontal" >
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#color/white" >
</android.support.v4.view.ViewPager>
this is how i add each of the ListFragement to its parent Fragement (with the same layout) (in this case the contact list)
public class FragmentTabContacts extends FragmentTab{
#Override
protected Fragment getFragment() {
return new ListFragmentContactlist();
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
this.fragment = getFragment();
View view = inflater.inflate(R.layout.tab_fragement, null);
messageCanvas = (ViewGroup)view.findViewById(R.id.message_canvas);
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(R.id.tab_fragment, this.fragment);
fragmentTransaction.commit();
return view;
}
}
this is the adapter for the ViewPager
public class FragmentAdapter extends FragmentPagerAdapter {
/**
* list of {#link NinjaListFragment} used for all tabs
*/
private List<ITabContainer> fragments;
public FragmentAdapter(FragmentManager fm, List<ITabContainer> fragments) {
super(fm);
this.fragments = fragments;
}
#Override
public int getCount() {
return this.fragments.size();
}
#Override
public Fragment getItem(int position) {
return (Fragment) fragments.get(position);
}
#Override
public int getItemPosition(Object object) {
return fragments.indexOf(object);
}
}
and this is the method i wrote inside the ViewPager to set the new Fragements to it and also the corresponsing tabs
/**
* adds the {#link ViewGroup} representing the tab to the {#value #mapTabs} for generating the tabs
* #param inflater the {#link LayoutInflater} used to inflate the tab
* #param tabs the {#link ViewGroup} containing the inflated tabs.
* #param tabContainer the fragment with the interface {#link ITabContainer} used as content for the tab added to {#link #fragments}
* #param imageId the id of the image to be shown on the tab
* #param onClickListener the {#link View.OnClickListener} to receive the tab clicks
*/
private void addTab(LayoutInflater inflater, ViewGroup tabs, ITabContainer tabContainer, int imageId, View.OnClickListener onClickListener) {
inflater.inflate(R.layout.main_tab, tabs);
int index = tabs.getChildCount() - 1;
ImageView ivTab = (ImageView) tabs.getChildAt(index);
ivTab.setTag(String.valueOf(index));
ivTab.setImageResource(imageId);
ivTab.setOnClickListener(onClickListener);
mapTabs.put(index, ivTab);
fragments.add(tabContainer);
}
and this is how i call this method in the onCreate method of the ViewPager
addTab(inflater, vgTabs, new FragmentTabContacts(), R.drawable.ic_tab_contacts, onClickListener);
addTab(inflater, vgTabs, new FragmentTabHistory(), R.drawable.ic_tab_history, onClickListener);
addTab(inflater, vgTabs, new ListFragmentGroups(), R.drawable.ic_tab_groups, onClickListener);
addTab(inflater, vgTabs, new FragmentTabFavorits(), R.drawable.ic_tab_favorits, onClickListener);
because naturally all of the fragements with the same layout contain the same id (android:id="#+id/tab_fragment") for the Framelayout where i add the ListFragement, it seems that the ViewPager has a problem identifying each of them. i only completed the first 2 pages that way (the 4th tab contains another ViewPager and this works), but the result is that the first page shows now the content of the second one, while the second page is empty.
i want to have a seperate TextView for each page because i want to store different text inside each page, and i dont want to copy the same layout (just with different ids) 4 times (in case there is no other solution for it).and i dont want to put that TextView inside the main PageView layout and refresh the content after each tab switch.
what can i do to reuse the same layout for each ListFragement of each page?
meanwhile i found a simple workaround. i created 4 different layouts (with 4 different ids for the fragement) for all 4 pagesand include the same redundant parts in each of them
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/tab_page"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="#+id/list_history"
android:name="at.happyninja.addressbook.fragments.ListFragmentHistory"
android:layout_width="match_parent"
android:layout_height="0sp"
android:layout_weight="1" />
<include layout="#layout/tab_message" />
<include layout="#layout/tab_keyboardview" />
I browsed StackOverflow for days before deciding to post my own question. I really can't figure this out.
I'm using ActionBarSherlock to implement a viewpager with 2 tabs. I managed to get a ListView on the first tab and everything is working perfectly, at least until I click on one of the list items.
Here's the interesting code in my SherlockListFragment
#Override
public void onViewCreated(View view, Bundle savedInstanceState){
// Click event for single list row
getListView().setOnItemClickListener(new OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(getActivity(), "CLICKED", Toast.LENGTH_SHORT).show();
HashMap<String, String> videoz = new HashMap<String, String>();
videoz = (HashMap<String, String>) parent.getAdapter().getItem(position);
String videoid = "test";
Prova singleitem = new Prova();
Bundle bundle = new Bundle();
bundle.putString("KEY_ID", videoid);
singleitem.setArguments(bundle);
FragmentTransaction trans = getFragmentManager().beginTransaction();
trans.replace(R.id.main_layout, singleitem);
trans.addToBackStack(null);
trans.commit();
}
});
}
This code actually works and open up my "Prova" fragment, but it breaks everything. It appears below my admob (which is normally sticked to the bottom) and the tab bar doesn't work anymore. What am I missing here?
Listview with tab bar still working:
http://imgur.com/FapadTH,TByd05U#1
After clicking an item:
http://imgur.com/FapadTH,TByd05U#0
My main layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/main_layout"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</android.support.v4.view.ViewPager>
<LinearLayout
android:id="#+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="xxxxxx"
ads:adSize="SMART_BANNER"
ads:loadAdOnCreate="false"
/>
</LinearLayout>
</LinearLayout>
THANKS IN ADVANCE!
I see a lot of questions being asked in the stackoverflow on the same topic, but i could not understand the deep problem of the exception.
Below is my XML layout. I have a listView.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:background="#FFFFFF">
<ListView
android:id="#+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#656565"
android:paddingLeft="#dimen/list_padding"
android:paddingRight="#dimen/list_padding"
android:dividerHeight="20.0sp"
android:divider="#656565"/>
</LinearLayout>
Below is my Fragment class.
public class FragmentClass extends SherlockListFragment implements AsyncListner{
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.documents, container, false);
}
#Override
public void onActivityCreated(Bundle savedInstanceState){
}
#Override
public void onLoadComplete(List<DocumentResponse> data) {
DocumentsAdapter adapter = new DocumentsAdapter(getSherlockActivity(),
R.id.list, data);
setListAdapter(adapter);
}
}
Once the onLoadComplete call is finished, i am trying to create my ListView. But i get this error. "Your content must have a ListView whose id attribute is android.R.id.list"
change android:id="#+id/list" to android:id="#android:id/list"
With this you are using the requested android.R.id.list id.
Don't forget to update the code, too
DocumentsAdapter adapter = new DocumentsAdapter(getSherlockActivity(), android.R.id.list, data);
I was looking into changing my solution to use Fragments instead of ActivityGroups and found an example which allowed me to change the part of my ui depending on a ListView lying above it. What I want to do is have a ListView which, when an item is clicked, replaces itself so that only the new layout is visible - Is this possible?
Below you'll see the relevant code example I am using :
public class FragmentTestActivity extends FragmentActivity implements OnItemClickListener
{
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView l = (ListView) findViewById(R.id.number_list);
ArrayAdapter<String> magzTitles = new ArrayAdapter<String>(getApplicationContext(),
android.R.layout.simple_list_item_1,
new String[]{"Cupcake",
"TaberTHULE",
"Lite"});
l.setAdapter(magzTitles);
l.setOnItemClickListener(this);
}
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
Fragment testFragment = new TestFragment(position++);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.the_frag, testFragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.addToBackStack(null);
ft.commit();
}
}
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/frags"
>
<ListView
android:id="#+id/number_list"
android:layout_width="150dp"
android:layout_height="match_parent"
/>
<fragment class="com.android.saket.fragments.TestFragment"
android:id="#+id/the_frag"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
This is possible, what I'd do is to use a Framelayout as the container and then have two different fragments which will be switched out (the switching happens in your activity). This is pretty straight forward and you should not have troubles finding examples.