cannot use setText() will crash the app everytime : <p>text view will crash every time i use .setText() 
this is my activity
    TextView tvAvgRank;
    SharedPreferences pref;</p>

<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stats);

    pref = this.getSharedPreferences("ranks", Context.MODE_PRIVATE);

    tvAvgRank = (TextView)findViewById(R.id.tvAvgRank);
    tvAvgRank.setText(avgRank(loadRanks()));
}
</code></pre>
