Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Java类的加载时间比预期的长。我可以改变我的来源以加快速度吗?_Java_Android_Gridview - Fatal编程技术网

Android Java类的加载时间比预期的长。我可以改变我的来源以加快速度吗?

Android Java类的加载时间比预期的长。我可以改变我的来源以加快速度吗?,java,android,gridview,Java,Android,Gridview,我想知道我是否可以改变我的代码以加快加载时间。当用户想要更改主屏幕上的图标时,他们单击“选择图像”并选择“我的活动” 这就是延迟发生的时间。加载大约需要7到8秒。现在我确实加载了1000个图标,但在添加多个GridView之前,只需2到3秒钟。我添加了多个GridView,这样我就可以切掉我的图标,我想保留它 下面是加载icons2类时的日志。我删除了许多GC_FOR_ALLOC条目,因为它对于这篇文章来说太大了 我查看了DDMS,并将活动的分配跟踪器与其他主题进行了比较,这些主题很快,而且非常

我想知道我是否可以改变我的代码以加快加载时间。当用户想要更改主屏幕上的图标时,他们单击“选择图像”并选择“我的活动”

这就是延迟发生的时间。加载大约需要7到8秒。现在我确实加载了1000个图标,但在添加多个GridView之前,只需2到3秒钟。我添加了多个GridView,这样我就可以切掉我的图标,我想保留它

下面是加载icons2类时的日志。我删除了许多GC_FOR_ALLOC条目,因为它对于这篇文章来说太大了

我查看了DDMS,并将活动的分配跟踪器与其他主题进行了比较,这些主题很快,而且非常接近。我在想,在我的
icons2
类中,我做的工作比我需要的要多,还是填充这么多的GridView不是一个好的做法

06-13 14:14:09.334: D/dalvikvm(1779): GC_CONCURRENT freed 426K, 4% free 13815K/14352K, paused 10ms+0ms, total 15ms
06-13 14:14:09.525: W/Trace(1779): Unexpected value from nativeGetEnabledTags: 0
06-13 14:14:09.535: W/Trace(1779): Unexpected value from nativeGetEnabledTags: 0
06-13 14:14:09.535: W/Trace(1779): Unexpected value from nativeGetEnabledTags: 0
06-13 14:14:09.557: W/Trace(1779): Unexpected value from nativeGetEnabledTags: 0
06-13 14:14:09.595: W/Trace(1779): Unexpected value from nativeGetEnabledTags: 0
06-13 14:14:09.605: D/dalvikvm(1779): GC_CONCURRENT freed 1587K, 11% free 14168K/15868K, paused 6ms+3ms, total 11ms
06-13 14:14:09.655: D/dalvikvm(1779): GC_FOR_ALLOC freed 732K, 12% free 14424K/16280K, paused 5ms, total 13ms
06-13 14:14:09.685: D/dalvikvm(1779): GC_FOR_ALLOC freed 650K, 11% free 14804K/16572K, paused 3ms, total 3ms
06-13 14:14:09.705: D/dalvikvm(1779): GC_FOR_ALLOC freed 731K, 12% free 15060K/16944K, paused 2ms, total 2ms
06-13 14:14:09.737: D/dalvikvm(1779): GC_FOR_ALLOC freed 570K, 11% free 15435K/17152K, paused 14ms, total 14ms
06-13 14:14:09.905: D/dalvikvm(1779): GC_FOR_ALLOC freed 650K, 11% free 15733K/17564K, paused 117ms, total 117ms
06-13 14:14:10.044: D/dalvikvm(1779): GC_FOR_ALLOC freed 650K, 11% free 16032K/17856K, paused 129ms, total 129ms
06-13 14:14:10.104: D/dalvikvm(1779): GC_FOR_ALLOC freed 650K, 11% free 16331K/18188K, paused 18ms, total 18ms
06-13 14:14:10.144: D/dalvikvm(1779): GC_FOR_ALLOC freed 570K, 10% free 16675K/18480K, paused 4ms, total 5ms
06-13 14:14:10.214: D/dalvikvm(1779): GC_FOR_ALLOC freed 650K, 11% free 16893K/18772K, paused 18ms, total 18ms
06-13 14:14:10.224: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 17154K/18980K, paused 2ms, total 3ms
06-13 14:14:10.265: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 17416K/19268K, paused 17ms, total 17ms
06-13 14:14:10.285: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 17677K/19516K, paused 2ms, total 3ms
06-13 14:14:10.304: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 17939K/19804K, paused 3ms, total 3ms
06-13 14:14:10.344: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 18200K/20052K, paused 22ms, total 22ms
06-13 14:14:10.364: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 18462K/20340K, paused 3ms, total 4ms
06-13 14:14:10.374: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 18724K/20588K, paused 3ms, total 3ms
06-13 14:14:10.414: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 10% free 18986K/20876K, paused 18ms, total 19ms
06-13 14:14:10.444: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 9% free 19247K/21124K, paused 18ms, total 18ms
06-13 14:14:10.464: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 9% free 19553K/21372K, paused 3ms, total 3ms
06-13 14:14:10.474: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 9% free 19733K/21660K, paused 3ms, total 3ms
06-13 14:14:10.514: D/dalvikvm(1779): GC_FOR_ALLOC freed 489K, 9% free 20040K/21868K, paused 18ms, total 18ms
06-13 14:14:10.524: D/dalvikvm(1779): GC_FOR_ALLOC freed 569K, 9% free 20221K/22156K, paused 2ms, total 2ms
06-13 14:14:10.564: D/dalvikvm(1779): GC_FOR_ALLOC freed 488K, 9% free 20445K/22320K, paused 17ms, total 18ms
06-13 14:14:10.576: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 9% free 20669K/22528K, paused 3ms, total 3ms
06-13 14:14:10.614: D/dalvikvm(1779): GC_FOR_ALLOC freed 488K, 9% free 20893K/22776K, paused 19ms, total 19ms
06-13 14:14:10.624: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 9% free 21117K/22984K, paused 3ms, total 3ms
06-13 14:14:10.666: D/dalvikvm(1779): GC_FOR_ALLOC freed 491K, 9% free 21345K/23232K, paused 20ms, total 20ms
06-13 14:14:10.685: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 9% free 21569K/23480K, paused 6ms, total 7ms
06-13 14:14:10.714: D/dalvikvm(1779): GC_FOR_ALLOC freed 488K, 8% free 21793K/23688K, paused 18ms, total 18ms
06-13 14:14:10.744: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 9% free 22017K/23936K, paused 16ms, total 17ms
06-13 14:14:10.756: D/dalvikvm(1779): GC_FOR_ALLOC freed 406K, 8% free 22285K/24144K, paused 0ms, total 0ms
06-13 14:14:10.794: D/dalvikvm(1779): GC_FOR_ALLOC freed 488K, 8% free 22509K/24436K, paused 17ms, total 17ms
06-13 14:14:10.804: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 8% free 22652K/24600K, paused 6ms, total 6ms
06-13 14:14:10.847: D/dalvikvm(1779): GC_FOR_ALLOC freed 407K, 8% free 22920K/24808K, paused 22ms, total 22ms
06-13 14:14:10.865: D/dalvikvm(1779): GC_FOR_ALLOC freed 487K, 8% free 23063K/25056K, paused 7ms, total 7ms
06-13 14:14:10.895: D/dalvikvm(1779): GC_FOR_ALLOC freed 407K, 8% free 23249K/25140K, paused 18ms, total 18ms
06-13 14:14:10.924: D/dalvikvm(1779): GC_FOR_ALLOC freed 406K, 8% free 23436K/25348K, paused 17ms, total 17ms
06-13 14:14:10.937: D/dalvikvm(1779): GC_FOR_ALLOC freed 407K, 8% free 23623K/25556K, paused 13ms, total 13ms
06-13 14:14:11.065: D/dalvikvm(1779): GC_FOR_ALLOC freed 406K, 8% free 23810K/25764K, paused 117ms, total 117ms
06-13 14:14:11.075: D/dalvikvm(1779): GC_FOR_ALLOC freed 406K, 8% free 23997K/25932K, paused 5ms, total 5ms
06-13 14:14:11.085: D/dalvikvm(1779): GC_FOR_ALLOC freed 407K, 8% free 24183K/26140K, paused 3ms, total 3ms
06-13 14:14:11.105: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 24414K/26308K, paused 4ms, total 4ms
06-13 14:14:11.335: D/dalvikvm(1779): GC_FOR_ALLOC freed 407K, 8% free 24520K/26516K, paused 217ms, total 217ms
06-13 14:14:11.345: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 24669K/26600K, paused 13ms, total 13ms
06-13 14:14:11.355: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 24899K/26808K, paused 2ms, total 3ms
06-13 14:14:11.477: D/dalvikvm(1779): GC_FOR_ALLOC freed 407K, 8% free 25005K/27016K, paused 103ms, total 103ms
06-13 14:14:11.485: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 25154K/27100K, paused 3ms, total 3ms
06-13 14:14:11.614: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 25304K/27264K, paused 116ms, total 116ms
06-13 14:14:11.624: D/dalvikvm(1779): GC_FOR_ALLOC freed 326K, 8% free 25453K/27388K, paused 3ms, total 3ms
06-13 14:14:11.634: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 25603K/27552K, paused 5ms, total 6ms
06-13 14:14:11.654: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 25752K/27716K, paused 7ms, total 8ms
06-13 14:14:11.684: D/dalvikvm(1779): GC_FOR_ALLOC freed 326K, 8% free 25901K/27880K, paused 17ms, total 18ms
06-13 14:14:11.696: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 7% free 26051K/28004K, paused 3ms, total 3ms
06-13 14:14:11.716: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 7% free 26200K/28168K, paused 7ms, total 8ms
06-13 14:14:11.744: D/dalvikvm(1779): GC_FOR_ALLOC freed 326K, 7% free 26350K/28332K, paused 19ms, total 20ms
06-13 14:14:11.754: D/dalvikvm(1779): GC_FOR_ALLOC freed 325K, 8% free 26499K/28496K, paused 4ms, total 4ms
06-13 14:14:20.944: I/Choreographer(1779): Skipped 1161 frames! The application may be doing too much work on its main thread.
这是我的icons2课程

package bigdx.clean.multi;

import java.util.ArrayList;
import bigdx.clean.multi.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class Icons2 extends Activity {
    public Uri CONTENT_URI;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int iconSize=getResources().getDimensionPixelSize(android.R.dimen.app_icon_size);
        setContentView(R.layout.icon_picker);
        ExpandableHeightGridView g=(ExpandableHeightGridView) findViewById(R.id.icon_grid_folders);
        ExpandableHeightGridView g2=(ExpandableHeightGridView) findViewById(R.id.icon_grid_apps);
        ExpandableHeightGridView g3=(ExpandableHeightGridView) findViewById(R.id.icon_grid_google);
        ExpandableHeightGridView g4=(ExpandableHeightGridView) findViewById(R.id.icon_grid_system);
        ExpandableHeightGridView g5=(ExpandableHeightGridView) findViewById(R.id.icon_grid_games);
        ExpandableHeightGridView g6=(ExpandableHeightGridView) findViewById(R.id.icon_grid_text);
        g.setExpanded(true);
        g2.setExpanded(true);
        g3.setExpanded(true);
        g4.setExpanded(true);
        g5.setExpanded(true);
        g6.setExpanded(true);
        g.setNumColumns(GridView.AUTO_FIT);
        g2.setNumColumns(GridView.AUTO_FIT);
        g3.setNumColumns(GridView.AUTO_FIT);
        g4.setNumColumns(GridView.AUTO_FIT);
        g5.setNumColumns(GridView.AUTO_FIT);
        g6.setNumColumns(GridView.AUTO_FIT);
        g.setColumnWidth(iconSize);
        g2.setColumnWidth(iconSize);
        g3.setColumnWidth(iconSize);
        g4.setColumnWidth(iconSize);
        g5.setColumnWidth(iconSize);
        g6.setColumnWidth(iconSize);
        g.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
        g2.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
        g3.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
        g4.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
        g5.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
        g6.setStretchMode(GridView.STRETCH_SPACING_UNIFORM);
        g.setVerticalSpacing(iconSize/3);
        g2.setVerticalSpacing(iconSize/3);
        g3.setVerticalSpacing(iconSize/3);
        g4.setVerticalSpacing(iconSize/3);
        g5.setVerticalSpacing(iconSize/3);
        g6.setVerticalSpacing(iconSize/3);
        g.setAdapter(new IconsAdapter(this, iconSize, g.getId()));
        g2.setAdapter(new IconsAdapter(this, iconSize, g2.getId()));
        g3.setAdapter(new IconsAdapter(this, iconSize, g3.getId()));
        g4.setAdapter(new IconsAdapter(this, iconSize, g4.getId()));
        g5.setAdapter(new IconsAdapter(this, iconSize, g5.getId()));
        g6.setAdapter(new IconsAdapter(this, iconSize, g6.getId()));

        g.setOnItemClickListener(new AdapterView.OnItemClickListener(){
        private Uri CONTENT_URI = Uri.parse("content://" + IconsProvider.class.getCanonicalName());

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
                String str = adapterView.getItemAtPosition(position).toString();
                setResult(-1, new Intent(null, Uri.withAppendedPath(this.CONTENT_URI, str)));
                finish();
              }
    });
        g2.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            private Uri CONTENT_URI = Uri.parse("content://" + IconsProvider.class.getCanonicalName());

            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            String str = adapterView.getItemAtPosition(position).toString();
            setResult(-1, new Intent(null, Uri.withAppendedPath(this.CONTENT_URI, str)));
            finish();
        }
        });
        g3.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            private Uri CONTENT_URI = Uri.parse("content://" + IconsProvider.class.getCanonicalName());
        @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            String str = adapterView.getItemAtPosition(position).toString();
            setResult(-1, new Intent(null, Uri.withAppendedPath(this.CONTENT_URI, str)));
            finish();
        }
        });
        g4.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            private Uri CONTENT_URI = Uri.parse("content://" + IconsProvider.class.getCanonicalName());
        @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {

            String str = adapterView.getItemAtPosition(position).toString();
            setResult(-1, new Intent(null, Uri.withAppendedPath(this.CONTENT_URI, str)));
            finish();
         }
        });
        g5.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            private Uri CONTENT_URI = Uri.parse("content://" + IconsProvider.class.getCanonicalName());
        @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            String str = adapterView.getItemAtPosition(position).toString();
            setResult(-1, new Intent(null, Uri.withAppendedPath(this.CONTENT_URI, str)));
            finish();
        }
        });
        g6.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            private Uri CONTENT_URI = Uri.parse("content://" + IconsProvider.class.getCanonicalName());

            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {

                    String str = adapterView.getItemAtPosition(position).toString();
                    setResult(-1, new Intent(null, Uri.withAppendedPath(this.CONTENT_URI, str)));
                    finish();
                  }
        });
    }



    class IconsAdapter extends BaseAdapter{
        private Context mContext;
        private int mIconSize;
        private ArrayList<Integer> mThumbs;
        private int mG;

        public IconsAdapter(Context mContext, int iconsize, int g) {
            this.mContext = mContext;
            this.mIconSize = iconsize;
            this.mG = g;
                  loadIcons();
                }

        @Override
        public int getCount() {
            return mThumbs.size();
        }

        @Override
        public Object getItem(int position) {
            return mThumbs.get(position);
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ImageView imageView;
            if (convertView == null) {
                imageView = new ImageView(mContext);
                imageView.setLayoutParams(new GridView.LayoutParams(mIconSize, mIconSize));
            } else {
                imageView = (ImageView) convertView;
            }
            imageView.setImageResource(mThumbs.get(position));
            return imageView;
        }

        private void loadIcons() {

            final Resources resources = getResources();
            final String packageName = getApplication().getPackageName();

            int folders = R.id.icon_grid_folders;
            int apps = R.id.icon_grid_apps;
            int system = R.id.icon_grid_system;
            int google = R.id.icon_grid_google;
            int text = R.id.icon_grid_text;
            int games = R.id.icon_grid_games;

            if (mG == folders) {
                mThumbs = new ArrayList<Integer>();
                addIcons(resources, packageName, R.array.icon_pack_folders);
            }
            if (mG == apps) {
                mThumbs = new ArrayList<Integer>();
                addIcons(resources, packageName, R.array.icon_pack_apps);
            }
            if (mG == games) {
                mThumbs = new ArrayList<Integer>();
                addIcons(resources, packageName, R.array.icon_pack_games);
            }
            if (mG == text) {
                mThumbs = new ArrayList<Integer>();
                addIcons(resources, packageName, R.array.icon_pack_text);
            }
            if (mG == google) {
                mThumbs = new ArrayList<Integer>();
                addIcons(resources, packageName, R.array.icon_pack_google);
            }
            if (mG == system) {
                mThumbs = new ArrayList<Integer>();
                addIcons(resources, packageName, R.array.icon_pack_system);
            }
        }
        private void addIcons(Resources resources, String packageName, int list) {
            final String[] extras = resources.getStringArray(list);
            for (String extra : extras) {
                int res = resources.getIdentifier(extra, "drawable", packageName);
                if (res != 0) {
                    final int thumbRes = resources.getIdentifier(extra,"drawable", packageName);
                    if (thumbRes != 0) {
                        mThumbs.add(thumbRes);
                    }
                }
            }
        }

    }   
}
package bigdx.clean.multi;
导入java.util.ArrayList;
导入bigdx.clean.multi.R;
导入android.app.Activity;
导入android.content.Context;
导入android.content.Intent;
导入android.content.res.Resources;
导入android.net.Uri;
导入android.os.Bundle;
导入android.view.view;
导入android.view.ViewGroup;
导入android.widget.AdapterView;
导入android.widget.BaseAdapter;
导入android.widget.GridView;
导入android.widget.ImageView;
公共类Icons2扩展活动{
公共Uri内容\u Uri;
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
int iconSize=getResources().getDimensionPixelSize(android.R.dimen.app\u icon\u size);
setContentView(R.layout.icon\u选择器);
ExpandableHeightGridView g=(ExpandableHeightGridView)findViewById(R.id.icon\u grid\u文件夹);
ExpandableHeightGridView g2=(ExpandableHeightGridView)findViewById(R.id.icon\u grid\u apps);
ExpandableHeightGridView g3=(ExpandableHeightGridView)findViewById(R.id.icon\u grid\u google);
ExpandableHeightGridView g4=(ExpandableHeightGridView)findViewById(R.id.icon\u grid\u system);
ExpandableHeightGridView g5=(ExpandableHeightGridView)findViewById(R.id.icon\u grid\u games);
ExpandableHeightGridView g6=(ExpandableHeightGridView)findViewById(R.id.icon\u grid\u text);
g、 SETEXTEND(真);
g2.setExpanded(真);
g3.设置扩展(真);
g4.setExpanded(真);
g5.setExpanded(真);
g6.setExpanded(真);
g、 setNumColumns(GridView.AUTO_-FIT);
g2.setNumColumns(GridView.AUTO_FIT);
g3.setNumColumns(GridView.AUTO_FIT);
g4.setNumColumns(GridView.AUTO_FIT);
g5.setNumColumns(GridView.AUTO_FIT);
g6.setNumColumns(GridView.AUTO_U-FIT);
g、 设置列宽(iconSize);
g2.设置列宽(iconSize);
g3.设置列宽(iconSize);
g4.设置列宽(iconSize);
g5.设置列宽(iconSize);
g6.设置列宽(iconSize);
g、 setStretchMode(网格视图。拉伸间隔均匀);
g2.setStretchMode(网格视图、拉伸、间距均匀);
g3.设置拉伸模式(网格视图、拉伸、间距均匀);
g4.设置拉伸模式(网格视图、拉伸、间距、均匀);
g5.设置拉伸模式(网格视图、拉伸、间距、均匀);
g6.设置拉伸模式(网格视图、拉伸、间距均匀);
g、 设置垂直间距(iconSize/3);
g2.设置垂直间距(iconSize/3);
g3.设置垂直间距(iconSize/3);
g4.设置垂直间距(iconSize/3);
g5.设置垂直间距(iconSize/3);
g6.设置垂直间距(iconSize/3);
g、 setAdapter(新的iconAdapter(this,iconSize,g.getId());
setAdapter(新的iconAdapter(this,iconSize,g2.getId());
setAdapter(新的iconAdapter(this,iconSize,g3.getId());
setAdapter(新的iconAdapter(this,iconSize,g4.getId());
setAdapter(新的iconAdapter(this,iconSize,g5.getId());
setAdapter(新的iconAdapter(this,iconSize,g6.getId());
g、 setOnItemClickListener(新的AdapterView.OnItemClickListener(){
私有Uri CONTENT_Uri=Uri.parse(“CONTENT://”+iconProvider.class.getCanonicalName());
@凌驾
public void onItemClick(AdapterView AdapterView,视图视图,整型位置,长id){
String str=adapterView.getItemAtPosition(position.toString();
setResult(-1,新意图(null,Uri.withAppendedPath(this.CONTENT_Uri,str));
完成();
}
});
g2.setOnItemClickListener(新的AdapterView.OnItemClickListener(){
私有Uri CONTENT_Uri=Uri.parse(“CONTENT://”+iconProvider.class.getCanonicalName());
@凌驾
public void onItemClick(AdapterView AdapterView,视图视图,整型位置,长id){
String str=adapterView.getItemAtPosition(position.toString();
setResult(-1,新意图(null,Uri.withAppendedPath(this.CONTENT_Uri,str));
完成();
}
});
g3.setOnItemClickListener(新的AdapterView.OnItemClickListener(){
私有Uri CONTENT_Uri=Uri.parse(“CONTENT://”+iconProvider.class.getCanonicalName());
@凌驾
public void onItemClick(AdapterView AdapterView,视图视图,整型位置,长id){
String str=adapterView.getItemAtPosition(position.toString();
setResult(-1,新意图(null,Uri.withAppendedPath(this.CONTENT_Uri,str));
完成();
}
});
g4.setOnItemClickListener(新的AdapterView.OnItemClickListener(){
私有Uri CONTENT_Uri=Uri.parse(“CONTENT://”+iconProvider.class.getCanonicalName());
@凌驾
public void onItemClick(AdapterView AdapterView,视图视图,整型位置,长id){
String str=adapterView.getItemAtPosition(position.toString();
塞特