Skip to content
Advertisement

Tag: settext

SetText in fragment from outside class

I have a fragment that displays data from APIs, but i dont want to be calling apis everytime the fragment is called.. so am making api call from a different class and and calling a method in the fragment to update UI (textViews) but am getting null exception for the textViews but data is 100% there and if i try

Why is String.valueOf faster than String Concatenation for converting an Integer to a String?

This is the converse of the problem “Why is String concatenation faster than String.valueOf for converting an Integer to a String?”. It is not a duplicate. Rather, it stems from this answer with benchmarks asserting that t.setText(String.valueOf(number)) is faster than t.setText(“”+number), and ChristianB’s question as to why that is. Answer String addition results in the compiler creating a StringBuilder instance,

Advertisement