How to search an item string which is not written in search function activity file but in other java file?
<p>I have plan to implement search function on a product based on name. The product are store in shoppingcarthelper.java as List. Another java file name as searchActivity.java is to preform the search function on List based on name of the product. How should i call the List on searchActivity.java? Mostly the example that i saw declare the array in the searchActivity.java or main activity file not in other java file.
Below shows the shoppingcarthelper.java.</p>

<pre><code>public static final String PRODUCT_INDEX = "PRODUCT_INDEX";

private static List&lt;product&gt; catalog;
private static Map&lt;product, ShoppingCartEntry&gt; cartMap = new 
HashMap&lt;product, ShoppingCartEntry&gt;();

public static List&lt;product&gt; getCatalog(Resources res){
    if(catalog == null) {
        catalog = new Vector&lt;product&gt;();
        catalog.add(new product("Tudung", res
                .getDrawable(R.drawable.tudung),res
                .getDrawable(R.drawable.tudung1),res
                .getDrawable(R.drawable.tudung2),
                "Tudung testing.", 15.00, 0.20));
        catalog.add(new product("Baju Kurung", res
                .getDrawable(R.drawable.bajukurung),res
                .getDrawable(R.drawable.bajukurung1),res
                .getDrawable(R.drawable.bajukurung2),
                "Baju kurung baju kurung.", 59.90, 0.50));
    }

    return catalog;
</code></pre>

<p>Here is my search function. How should i write my search function so it retrieve List from shoppingcarthelper.java?</p>

<pre><code>    inputSearch.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence cs, int arg1, int arg2, int 
     arg3) {
            // When user changed the Text
            main_activity.this.adapter.getFilter().filter(cs);
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                                      int arg3) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable arg0) {
            // TODO Auto-generated method stub
        }
    });
</code></pre>