why is my code giving me a settext error?

john :

i have a setText method that seems to be fine and my code is perfect but it is still giving me an error when running the app.

my code:

    public class DetailsActivity extends AppCompatActivity {
    TextView textTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_details);

        textTitle = findViewById(R.id.details_shopName);

        Intent i = getIntent();
        String textTitle = i.getStringExtra("title");

        textTitle.setText(textTitle);

    }
}

THE ERROR READS:

error: cannot find symbol
        textTitle.setText(textTitle);
                 ^
  symbol:   method setText(String)
  location: variable textTitle of type String1
Fady Adal :

You have two conflicting variable names. This should work fine

 public class DetailsActivity extends AppCompatActivity {
    TextView textTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_details);

        textTitle = findViewById(R.id.details_shopName);

        Intent i = getIntent();
        String title = i.getStringExtra("title");

        textTitle.setText(title);

    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

I don't understand why compiler is giving me error with this code

What is lazy initialize in context with Spring Framework or Hibernate and why my code is giving me a "failed to lazy initialize error"?

Why is this giving me an undefined error?

Why is my conditional operator giving me an error?

Why is my code giving memory error?

Why is Processing.js giving me an error about a function that isn't in my code?

Don't understand why my code giving me an IndexError

C++,Shared_ptr, Please tell me why my code is giving an error?

Why is my SKAudioNode giving me an error?

Why my code giving me a stackdump error when I run it?

Why is this JavaScript code giving me error "undefined"?

Why does my C program keep giving me 1 as the error?

Why is my code giving Runtime Error?

Why is my Scan.nextDouble giving me an error for java?

Why is Xquery giving me an error on my variable? I

a line in my code is giving me "subscript out of range error"

My is my setOnClickListener giving me an error?

Why is the following sass code giving me an error?

Why this code is giving error?

Can you figure out why my code is giving me an IndexOutOfBounds error?

why using map is giving me the error( .map is not a function),it seems everything is ok in my code?

Why are my End values giving me a syntax error?

Why is my map function in React giving me an error? (...is not a function)

Why is my console giving me a bunch of error messages on Sublime?

Why is my code not giving any output even though there is no error in the code?

Why my code is giving error after i submit code

Why is my code giving segmentation fault error?

Why is this code giving me out of bound error?

Why is my code giving a value error that the list index is out of range?