Ошибка на странице Android. Не вызов varargs метода varargs - PullRequest
0 голосов
/ 27 января 2020

Я новичок в мобильных приложениях. Сейчас готовится приложение android, но я всегда получаю эту ошибку:

не-varargs вызов метода varargs с неточным типом аргумента для последнего параметра; приведение к объекту для вызова varargs приведение к Object [] для вызова без varargs и для подавления этого предупреждения

Код внутри:

AsyncTask asyncTask = new AsyncTask<String, String, String>() {

            LatLngBounds bounds;

            /**
             * Before starting background do some work.
             * */
            @Override
            protected void onPreExecute() {
            }

            @Override
            protected String doInBackground(String... params) {
                // TODO fetch url data do bg process.

                LatLngBounds.Builder builder = new LatLngBounds.Builder();

                int numberPlaceInclude = 1;

                try {
                    builder.include(new LatLng(Double.parseDouble(mFCity.getLatitude()), Double.parseDouble(mFCity.getLongitude())));
                    numberPlaceInclude++;
                } catch (NumberFormatException e) {
                    e.printStackTrace();
                } catch (Exception e) {
                    e.printStackTrace();
                }

                for (int i = 0; i < listAllPlace.size(); i++) {
                    if (listAllPlace.get(i).getLatitude() == null || listAllPlace.get(i).getLatitude().length() == 0 || listAllPlace.get(i).getLongitude() == null || listAllPlace.get(i).getLongitude().length() == 0) {
                        continue;
                    }
                    try {
                        if (listAllPlace.get(i).getLatLng() == null) {
                            listAllPlace.get(i).setLatLng(new LatLng(Double.parseDouble(listAllPlace.get(i).getLongitude()), Double.parseDouble(listAllPlace.get(i).getLatitude())));
                        }

                        builder.include(listAllPlace.get(i).getLatLng());
                        numberPlaceInclude++;
                    } catch (NumberFormatException e) {
                        e.printStackTrace();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (numberPlaceInclude > 0) {
                    bounds = builder.build();

                }
                return null;
            }

            /**
             * Update list ui after process finished.
             */
            protected void onPostExecute(String file_url) {
                runOnUiThread(new Runnable() {
                    public void run() {
                        /**
                         * Updating parsed JSON data into ListView
                         */
                        if (bounds != null) {
                            mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, Integer.parseInt(mFCity.getZoom())));
                        }
                    }
                });
            }

        };
        asyncTask.execute(new String[]{});

и:

        AsyncTask asyncTask = new AsyncTask<String, String, String>() {
            /**
             * Before starting background do some work.
             * */
            @Override
            protected void onPreExecute() {
            }

            @Override
            protected String doInBackground(String... params) {
                // TODO fetch url data do bg process.
                return null;
            }

            /**
             * Update list ui after process finished.
             */
            protected void onPostExecute(String file_url) {
                runOnUiThread(new Runnable() {
                    public void run() {
                        /**
                         * Updating parsed JSON data into ListView
                         */

                        for (int i = 0; i < listAllPlace.size(); i++) {
                            try {
//                                LoggerFactory.d("PARSE Location : " + listAllPlace.get(i).getName() + "-lat: " + listAllPlace.get(i).getLatitude() + " lon: " + listAllPlace.get(i).getLongitude());
                                if (!listAllPlace.get(i).isDeactived()) {
                                    boolean categoryAccept = false;
                                    if (category == null || category.length() == 0) {
                                        categoryAccept = true;
                                    } else if (listAllPlace.get(i).getCategories() != null && listAllPlace.get(i).getCategories().size() > 0 &&
                                            listAllPlace.get(i).getCategories().toString().contains(category)) {
                                        categoryAccept = true;
                                    }

                                    if (listAllPlace.get(i).getLatitude() != null && listAllPlace.get(i).getLatitude().length() > 0
                                            && listAllPlace.get(i).getLongitude() != null && listAllPlace.get(i).getLongitude().length() > 0
                                            && categoryAccept
                                            ) {
                                        if (listAllPlace.get(i).getLatLng() == null) {
                                            listAllPlace.get(i).setLatLng(new LatLng(
                                                    Double.parseDouble(listAllPlace.get(i).getLongitude()),
                                                    Double.parseDouble(listAllPlace.get(i).getLatitude())));
                                        }

                                        Marker marker = mMap.addMarker(new MarkerOptions()
                                                .position(listAllPlace.get(i).getLatLng())
                                                .title(listAllPlace.get(i).getName())
                                                .icon(vectorToBitmap(Place.getPlaceMaker(listAllPlace.get(i))))
                                                .snippet(listAllPlace.get(i).getPlaceKey())
                                                .flat(false)
                                                .rotation(0));
                                        marker.setTag(listAllPlace.get(i));
                                    }
                                }
                            } catch (NumberFormatException e) {
                                e.printStackTrace();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }
                });
            }

        };
        asyncTask.execute(new String[]{});

может кто-то помогите мне?

Большое вам спасибо.

...