Search in sources :

Example 31 with SimpleAdapter

use of android.widget.SimpleAdapter in project android_frameworks_base by crdroidandroid.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra(EXTRA_PATH);
    if (path == null) {
        path = "";
    } else {
        // not root level, display where we are in the hierarchy
        setTitle(path);
    }
    FragmentManager fm = getSupportFragmentManager();
    if (fm.findFragmentById(android.R.id.content) == null) {
        ListFragment listFragment = new TestListFragment();
        listFragment.setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
        fm.beginTransaction().add(android.R.id.content, listFragment).commit();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) ListFragment(android.support.v4.app.ListFragment) SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Example 32 with SimpleAdapter

use of android.widget.SimpleAdapter in project android_frameworks_base by crdroidandroid.

the class HwTests method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    String path = intent.getStringExtra("com.android.test.hwui.Path");
    if (path == null) {
        path = "";
    }
    setListAdapter(new SimpleAdapter(this, getData(path), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
    getListView().setTextFilterEnabled(true);
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) Intent(android.content.Intent)

Example 33 with SimpleAdapter

use of android.widget.SimpleAdapter in project double-espresso by JakeWharton.

the class LongListActivity method onCreate.

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    populateData();
    setContentView(R.layout.list_activity);
    ((TextView) findViewById(R.id.selection_row_value)).setText("");
    ((TextView) findViewById(R.id.selection_column_value)).setText("");
    ListView listView = (ListView) findViewById(R.id.list);
    String[] from = new String[] { STR, LEN };
    int[] to = new int[] { R.id.item_content, R.id.item_size };
    layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ListAdapter adapter = new SimpleAdapter(this, data, R.layout.list_item, from, to) {

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = layoutInflater.inflate(R.layout.list_item, null);
            }
            TextView textViewOne = (TextView) convertView.findViewById(R.id.item_content);
            if (textViewOne != null) {
                textViewOne.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        ((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
                        ((TextView) findViewById(R.id.selection_column_value)).setText("1");
                    }
                });
            }
            TextView textViewTwo = (TextView) convertView.findViewById(R.id.item_size);
            if (textViewTwo != null) {
                textViewTwo.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        ((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
                        ((TextView) findViewById(R.id.selection_column_value)).setText("2");
                    }
                });
            }
            return super.getView(position, convertView, parent);
        }
    };
    View footerView = layoutInflater.inflate(R.layout.list_item, listView, false);
    ((TextView) footerView.findViewById(R.id.item_content)).setText("count:");
    ((TextView) footerView.findViewById(R.id.item_size)).setText(String.valueOf(data.size()));
    listView.addFooterView(footerView, FOOTER, true);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> unusedParent, View clickedView, int position, long id) {
            ((TextView) findViewById(R.id.selection_column_value)).setText("");
            ((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
        }
    });
}
Also used : ViewGroup(android.view.ViewGroup) SimpleAdapter(android.widget.SimpleAdapter) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ListAdapter(android.widget.ListAdapter)

Example 34 with SimpleAdapter

use of android.widget.SimpleAdapter in project double-espresso by JakeWharton.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setListAdapter(new SimpleAdapter(this, getData(), android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 }));
    getListView().setTextFilterEnabled(true);
}
Also used : SimpleAdapter(android.widget.SimpleAdapter)

Example 35 with SimpleAdapter

use of android.widget.SimpleAdapter in project double-espresso by JakeWharton.

the class LongListActivity method onCreate.

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    populateData();
    setContentView(R.layout.list_activity);
    ((TextView) findViewById(R.id.selection_row_value)).setText("");
    ((TextView) findViewById(R.id.selection_column_value)).setText("");
    ListView listView = (ListView) findViewById(R.id.list);
    String[] from = new String[] { STR, LEN };
    int[] to = new int[] { R.id.item_content, R.id.item_size };
    layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ListAdapter adapter = new SimpleAdapter(this, data, R.layout.list_item, from, to) {

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            if (convertView == null) {
                convertView = layoutInflater.inflate(R.layout.list_item, null);
            }
            TextView textViewOne = (TextView) convertView.findViewById(R.id.item_content);
            if (textViewOne != null) {
                textViewOne.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        ((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
                        ((TextView) findViewById(R.id.selection_column_value)).setText("1");
                    }
                });
            }
            TextView textViewTwo = (TextView) convertView.findViewById(R.id.item_size);
            if (textViewTwo != null) {
                textViewTwo.setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        ((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
                        ((TextView) findViewById(R.id.selection_column_value)).setText("2");
                    }
                });
            }
            return super.getView(position, convertView, parent);
        }
    };
    View footerView = layoutInflater.inflate(R.layout.list_item, listView, false);
    ((TextView) footerView.findViewById(R.id.item_content)).setText("count:");
    ((TextView) footerView.findViewById(R.id.item_size)).setText(String.valueOf(data.size()));
    listView.addFooterView(footerView, FOOTER, true);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> unusedParent, View clickedView, int position, long id) {
            ((TextView) findViewById(R.id.selection_column_value)).setText("");
            ((TextView) findViewById(R.id.selection_row_value)).setText(String.valueOf(position));
        }
    });
}
Also used : ViewGroup(android.view.ViewGroup) SimpleAdapter(android.widget.SimpleAdapter) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ListAdapter(android.widget.ListAdapter)

Aggregations

SimpleAdapter (android.widget.SimpleAdapter)72 Intent (android.content.Intent)29 ListView (android.widget.ListView)18 HashMap (java.util.HashMap)15 View (android.view.View)12 AdapterView (android.widget.AdapterView)12 Map (java.util.Map)9 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 FragmentManager (android.support.v4.app.FragmentManager)4 ListFragment (android.support.v4.app.ListFragment)4 OnClickListener (android.view.View.OnClickListener)4 ArrayList (java.util.ArrayList)4 Context (android.content.Context)3 ViewGroup (android.view.ViewGroup)3 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)3 ListAdapter (android.widget.ListAdapter)3 SharedPreferences (android.content.SharedPreferences)2 AssetManager (android.content.res.AssetManager)2 SQLException (android.database.SQLException)2