How to get an id of a View inside a Fragment
<p>Hi I am trying to get an id of some View in a Fragment from a string, however it doesn't seem to work... Is there a special case for fragments?</p>

<pre><code>@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View singleplayerView = inflater.inflate(R.layout.singleplayer_tab, container, false);
        setupMap();
        return singleplayerView;
    }

    private void setupRank() {
        TextView view = (TextView) getByStringId("rank0");
        view.setText("hello");
    }



    private final View getByStringId(final String id) {
        return findViewById(getResources().getIdentifier(id, "id", getActivi

ty().getPackageName()));
        }
</code></pre>

<p>So I am trying to set the textView field rank0 in the layout that is used for my fragment... but right now it gets a NUllPointer because it couldnt find the id</p>

<p>Thank you</p>
