Search in sources :

Example 6 with SimpleAdapter

use of android.widget.SimpleAdapter in project android-app by eoecn.

the class UserCollectListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreateView(inflater, container, savedInstanceState);
    mContext = inflater.getContext();
    View view = inflater.inflate(R.layout.user_collect_list, null);
    mlv = (ListView) view.findViewById(R.id.user_listview_collect);
    mlist = new ArrayList<Map<String, Object>>();
    getData();
    mAdapter = new SimpleAdapter(inflater.getContext(), mlist, R.layout.user_collect_list_item, new String[] { "name", "content" }, new int[] { R.id.user_textview_collectTitle, R.id.user_textview_collectContent });
    mlv.setAdapter(mAdapter);
    mlv.setOnItemClickListener(this);
    return view;
}
Also used : SimpleAdapter(android.widget.SimpleAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with SimpleAdapter

use of android.widget.SimpleAdapter in project android-app by eoecn.

the class UserIntroFragment method initGridView.

private void initGridView() {
    getData();
    mAdapter = new SimpleAdapter(mContext, mList, R.layout.user_gridview_item_medal, new String[] { "img" }, new int[] { R.id.user_imageview_medal }) {

        @Override
        public void setViewImage(ImageView v, String value) {
            // TODO Auto-generated method stub
            super.setViewImage(v, value);
            ImageUtil.setThumbnailView(value, v, mContext, new imageCallback(), false);
        }

        class imageCallback implements ImageCallback {

            @Override
            public void loadImage(Bitmap bitmap, String imagePath) {
                // TODO Auto-generated method stub
                try {
                    ImageView img = (ImageView) gvGrid.findViewWithTag(imagePath);
                    img.setImageBitmap(bitmap);
                } catch (NullPointerException ex) {
                    Log.e("error", "ImageView = null");
                }
            }
        }
    };
    gvGrid.setAdapter(mAdapter);
}
Also used : Bitmap(android.graphics.Bitmap) SimpleAdapter(android.widget.SimpleAdapter) ImageCallback(cn.eoe.app.utils.ImageUtil.ImageCallback) ImageView(android.widget.ImageView)

Example 8 with SimpleAdapter

use of android.widget.SimpleAdapter in project android-app by eoecn.

the class MainActivity method initListView.

private void initListView() {
    lvAdapter = new SimpleAdapter(this, getData(), R.layout.behind_list_show, new String[] { LIST_TEXT, LIST_IMAGEVIEW }, new int[] { R.id.textview_behind_title, R.id.imageview_behind_icon }) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub.
            View view = super.getView(position, convertView, parent);
            if (position == mTag) {
                view.setBackgroundResource(R.drawable.back_behind_list);
                lvTitle.setTag(view);
            } else {
                view.setBackgroundColor(Color.TRANSPARENT);
            }
            return view;
        }
    };
    lvTitle.setAdapter(lvAdapter);
    lvTitle.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            NavigationModel navModel = navs.get(position);
            mAboveTitle.setText(navModel.getName());
            current_page = navModel.getTags();
            if (lvTitle.getTag() != null) {
                if (lvTitle.getTag() == view) {
                    MainActivity.this.showContent();
                    return;
                }
                ((View) lvTitle.getTag()).setBackgroundColor(Color.TRANSPARENT);
            }
            lvTitle.setTag(view);
            view.setBackgroundResource(R.drawable.back_behind_list);
            imgQuery.setVisibility(View.VISIBLE);
            switch(position) {
                case 0:
                    imgQuery.setVisibility(View.GONE);
                    new MyTask().execute(topDao);
                    break;
                case 1:
                    new MyTask().execute(newsDao);
                    break;
                case 2:
                    new MyTask().execute(wikiDao);
                    break;
                case 3:
                    new MyTask().execute(blogsDao);
                    break;
            }
        }
    });
}
Also used : NavigationModel(cn.eoe.app.entity.NavigationModel) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ViewGroup(android.view.ViewGroup) SimpleAdapter(android.widget.SimpleAdapter) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 9 with SimpleAdapter

use of android.widget.SimpleAdapter in project AndroidDynamicLoader by mmin18.

the class ListApkFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    try {
        AssetManager asset = getActivity().getAssets();
        for (String s : asset.list("apks")) {
            addItem(s, "apks/" + s);
        }
    } catch (Exception e) {
    }
    SimpleAdapter adapter = new SimpleAdapter(getActivity(), data, android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 });
    setListAdapter(adapter);
}
Also used : AssetManager(android.content.res.AssetManager) SimpleAdapter(android.widget.SimpleAdapter)

Example 10 with SimpleAdapter

use of android.widget.SimpleAdapter in project AndroidDynamicLoader by mmin18.

the class ActivityLoader method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addItem("[ Launch SampleActivity ]", null);
    addItem("[ Default.apk ]", null);
    try {
        AssetManager asset = getAssets();
        for (String s : asset.list("apks")) {
            addItem(s, "apks/" + s);
        }
    } catch (Exception e) {
    }
    SimpleAdapter adapter = new SimpleAdapter(this, data, android.R.layout.simple_list_item_1, new String[] { "title" }, new int[] { android.R.id.text1 });
    setListAdapter(adapter);
}
Also used : AssetManager(android.content.res.AssetManager) SimpleAdapter(android.widget.SimpleAdapter)

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