加载Android中未响应

时间:2017-03-30 09:20:49

标签: android

任何人都可以帮我修复Android应用中的加载有害而无响应吗?我是Android的新手,我必须做我的项目,并且有Android OS 6的错误。

应用程序在地图上显示群组人员,点击“联系人”图标,然后显示群组人员列表。

目前,在OS 6以下的其他操作系统上工作正常,在操作系统6中更改为有朋友或成员的组时,然后单击“联系”,加载被卡住并且没有响应警报显示。我不知道为什么。

但是没有会员或朋友的团体工作正常。我将向您展示下面的截图。

图像一是组中没有成员和朋友(组名是Test1)。

https://drive.google.com/file/d/0BwG4MW1kR1WMSGNHYXNENzVGVUE/view

图像二是选择非会员组并单击联系人图标,列表只显示我。(工作正常,组中没有成员)。

https://drive.google.com/file/d/0BwG4MW1kR1WMcXc5NDc0c09nRXc/view

图像三被选为拥有会员或朋友的群组。(群组名称为tt。)位置指针显示在地图中。

https://drive.google.com/file/d/0BwG4MW1kR1WMbEdHZUs2NGZPYW8/view

图像四是选择具有成员的组并单击联系人图标,然后显示错误。 (加载图标被卡住,几秒钟或几分钟后,将无法显示响应警报。)

https://drive.google.com/file/d/0BwG4MW1kR1WMbF94cjQySkJhSDA/view

这是LogCat截图(老实说我看不懂在看到LogCat后如何解决)https://drive.google.com/file/d/0BwG4MW1kR1WMalRrN3psS0h2a28/view

 @Override
protected View onCreateMainView(LayoutInflater inflater) {
    Log.d(TAG, "Start Up");
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
        Log.d(TAG, "Start Up Condition");
        if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {

            Log.d(TAG, "Start Up SelfCheck");

            final AlertDialog.Builder builder = new AlertDialog.Builder(((MainActivity ) getActivity()));
            builder.setIcon(R.drawable.ico_info_popup_locator);
            builder.setTitle("Already accept location");
            builder.setMessage("Location was already accepted~!");
            builder.setPositiveButton(android.R.string.ok, null);

            builder.show();

        } else {

            final AlertDialog.Builder builder = new AlertDialog.Builder(((MainActivity ) getActivity()));
            builder.setIcon(R.drawable.ico_info_popup_locator);
            builder.setTitle("Location need to accept");
            builder.setMessage("Please Accept to use your location service~!");
            builder.setPositiveButton(android.R.string.ok, null);
            builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, MY_PERMISSIONS_REQUEST_LOCATION);
                }

                private void requestPermissions(String[] strings, int permissionRequestCoarseLocation) {
                    // TODO Auto-generated method stub

                }
            });
            builder.show();
        }
    }

    map_layout = inflater.inflate(R.layout.map_fragment, null, false);
    viewContaner = (RelativeLayout) map_layout.findViewById(R.id.viewContaner);
    viewContaner.setVisibility(View.INVISIBLE);

    mapZoomLevel =
            SharePreferencesUtil.getIntValue(ISharePreferencesDefine.KEY_STORE_LEVEL_ZOOM,
                    IConstants.LEVEL_ZOOM_MAP_DEFAULT);
    actionGetUser();
    LocationTracking.getInstance().setOnLocationChangedListener(this);
    initMap();

    return map_layout;
}
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

    if (requestCode == MY_PERMISSIONS_REQUEST_LOCATION) {

        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {

           Log.d(TAG, "coarse location permission granted");

        } else {

            final AlertDialog.Builder builder = new AlertDialog.Builder(((MainActivity ) getActivity()));
            builder.setIcon(R.drawable.ico_info_popup_locator);
            builder.setTitle("Location need to accept");
            builder.setMessage("Please Accept to use your location service~!");
            builder.setPositiveButton(android.R.string.ok, null);
            builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, MY_PERMISSIONS_REQUEST_LOCATION);
                }

                private void requestPermissions(String[] strings, int permissionRequestCoarseLocation) {
                    // TODO Auto-generated method stub

                }
            });
            builder.show();
        }
    }
}

1 个答案:

答案 0 :(得分:0)

但也许你有权限的问题。我认为在Android API Level 23 之上,您在应用运行时获得了具有权限请求的应用的权限。但是,您可能不会考虑使用较旧的设备,并且在使用 Mainifest.XML 安装时,您无法获得应用的权限。也许这就是你加载卡住的原因。或者您只是使用新设备的语法,旧设备无法解决它。