Ошибка class is never used to

IntelliJ IDEA error class is never used

tags: IntelliJ IDEA gives an error

Intelligent Recommendation

IntelliJ IDEA is installed and used

Focus: 1.Download and install IntelliJ IDEA 2. IDEA setting introduction and some configuration Key analysis: https://www.jetbrains.com No plugins installed Ps: If there is no picture that I put it on…

More Recommendation

IntelliJ IDEA bug error

The console shows: I personally imported this project written by someone else and got this error when running the code Solution: File → Project Settings → Modules → Language level, sele…

JavaRush JavaRush — это интерактивный онлайн-курс по изучению Java-программирования c нуля. Он содержит 1200 практических задач с проверкой решения в один клик, необходимый минимум теории по основам Java и мотивирующие фишки, которые помогут пройти курс до конца: игры, опросы, интересные проекты и статьи об эффективном обучении и карьере Java‑девелопера.

Подписывайтесь

Нашел блок кода, который выдает название указанной вэб страницы(библиотека jsoup):

package com.uzconv.uzflsoft.uzconv;

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.IOException;


public class AboutActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);
        TextView tv = (TextView) findViewById(R.id.testtextview);
        tv.setMovementMethod(new ScrollingMovementMethod());

    }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    private class TITLE extends AsyncTask<Void, Void, Void> {
        String title;

        @Override
        protected void onPreExecute() {
            super.onPreExecute();

        }

        @Override
        protected Void doInBackground(Void... params) {
            try {
                // Connect to the web site
                Document document = Jsoup.connect("http://wikipedia.org").get();
                // Get the html document title
                title = document.title();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            // Set title into TextView
            TextView tv = (TextView) findViewById(R.id.testtextview);
            tv.setText(title);

        }

    }
////////////////////////////////////////////////////////////////////////////////////
}

Студия пишет: class TITLE is never used. Как я понял он не выполняется. В jave я не большой знаток, может его нужно активировать командой? Искал в гугле — безрезультатно. Возможно что-то не так понял. Заранее спасибо за помощь.


  • Вопрос задан

    более трёх лет назад

  • 1647 просмотров

TITLE тянет с сети код главной страницы википедии. Т.к. это долгая операция она должна быть выполнена в фоновом потоке, чем TITLE собственно и является.
Вам нужно вызвать execute() чтобы запустить TITLE.

TITLE title = new TITLE();
title.execute();

например в конце onCreate

Пригласить эксперта

Этот класс нигде не инстанцируется, что очень странно.
Это внутренний private class класса AboutActivity, и он не может быть инстанцирован ниоткуда извне. Должен быть создан новый экземпляр (объект) где-то в этом файле.
Код должен быть примерно такой:
TITLE title = new TITLE();
Вам стоит связаться с разработчиками этого куска кода и уточнить у них. Здесь какая-то ошибка.


  • Показать ещё
    Загружается…

13 июн. 2023, в 14:45

3500 руб./за проект

13 июн. 2023, в 14:38

1000 руб./за проект

13 июн. 2023, в 14:15

50000 руб./за проект

Минуточку внимания

If there are methods that aren’t used, and you have no plan to use them, you should just delete them. They take up space in the APK and space is valuable when you only have 100MB before you have to use expansion files.

Some tools like Proguard can optimize away unused methods, but again, if there’s no use for it, get rid of it.

If there are unused methods and classes you are planning to use, do not delete them.

Android Studio shows suggestions if you click Alt+Enter, including removal, which you can apply to the entire file if you don’t want to remove them manually.

And if you plan on using them, you can get rid of the warning by suppressing it — again Alt+Enter, but click the arrow left, and it’ll auto-generate a suppression annotation for whatever scope you want, or my manually adding:

@SuppressWarnings("unused")

To the scope you want to suppress it in (as in either the class, or only the function).

But remember: it’s a warning, not an error. You can ignore it, as it doesn’t have any consequences aside a potentially bloated APK/Jar

Skip to content


Sign up


  • In this repository


    All GitHub

  • No suggested jump to results

  • In this repository


    All GitHub


  • In this organization


    All GitHub


  • In this repository


    All GitHub

Sign in

Sign up

This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

getgauge

/

Intellij-Plugin

Public archive

  • Notifications
  • Fork
    28


  • Star
    42

Closed

pavelpp opened this issue

Mar 23, 2016

· 3 comments

Closed

Method/Class X is never used

#125

pavelpp opened this issue

Mar 23, 2016

· 3 comments

Assignees

@sswaroopgupta

Labels

enhancement

Comments

@pavelpp



Copy link


pavelpp

commented

Mar 23, 2016



edited by sswaroopgupta

Currently step classes and methods are always marked as never used in IntelliJ. I’d like to see a real picture when I open steps classes. Adding @SuppressWarnings(«unused») looks like an overkill.

@sriv
sriv

added
the

enhancement

label

Mar 29, 2016

@mahendrakariya
mahendrakariya

mentioned this issue

Apr 6, 2016

Getting an exception while removing a method implementation listed as safe to delete
#131

Closed

kashishm

added a commit
that referenced
this issue

May 3, 2016

@kashishm


Removing unused method warnings if step implementation is used in s…


91747fc

…pec/concept file #125

@kashishm
kashishm

self-assigned this

May 3, 2016

@kashishm
kashishm

added
the

in progress

label

May 3, 2016

@kashishm



Copy link


Collaborator


kashishm

commented

May 3, 2016

Fix will be available in nightly > 3/5/2016

@kashishm
kashishm

added

ready for QA

and removed

in progress

labels

May 3, 2016

@kashishm
kashishm

assigned sswaroopgupta and unassigned kashishm

May 3, 2016

@sswaroopgupta



Copy link


Contributor


sswaroopgupta

commented

May 4, 2016



edited by kashishm

Getting the safe delete for a step which has an implementation

Related Issues

  • Data table given inline not getting generated as a parameter in a concept #145

@sswaroopgupta
sswaroopgupta

added

ready

and removed

ready for QA

labels

May 4, 2016

@kashishm



Copy link


Collaborator


kashishm

commented

Dec 22, 2016

@sguptatw #145 is closed. Can we close this now

@kashishm
kashishm

added

ready for QA

and removed

ready

labels

Dec 22, 2016

@sswaroopgupta
sswaroopgupta

closed this as completed

Jan 2, 2017

@sswaroopgupta
sswaroopgupta

removed

enhancement

ready for QA

labels

Jan 2, 2017

@kashishm
kashishm

added
the

enhancement

label

Feb 16, 2017

Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.

Assignees

@sswaroopgupta

sswaroopgupta

Labels

enhancement

Milestone

No milestone

Development

No branches or pull requests

4 participants

@sriv

@pavelpp

@kashishm

@sswaroopgupta

Понравилась статья? Поделить с друзьями:
  • Ошибка cl04 при запуске мта
  • Ошибка cl03 в мта провинция при запуске
  • Ошибка cl на машинке lg что означает как отключить
  • Ошибка cl на машинке lg как снять блокировку
  • Ошибка cl в стиральной машине lg с сенсорной панелью