-
Notifications
You must be signed in to change notification settings - Fork 0
/
RiverFragment.java
35 lines (24 loc) · 1.02 KB
/
RiverFragment.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.test_drawer;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class RiverFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Retrieving the currently selected item number
int position = getArguments().getInt("position");
// List of rivers
String[] rivers = getResources().getStringArray(R.array.rivers);
// Creating view correspoding to the fragment
View v = inflater.inflate(R.layout.fragment_layout, container, false);
// Getting reference to the TextView of the Fragment
TextView tv = (TextView) v.findViewById(R.id.tv_content);
// Setting currently selected river name in the TextView
tv.setText(rivers[position]);
return v;
}
}