質問編集履歴

2

コード修正

2018/02/23 05:44

投稿

nobu09
nobu09

スコア34

test CHANGED
File without changes
test CHANGED
@@ -28,23 +28,25 @@
28
28
 
29
29
  Log.d("TAB_FRAGMENT_LOG","tabId:" + tabId);
30
30
 
31
- if(mLastTabId != tabId){
31
+ if(mLastTabId.equals(tabId)){
32
32
 
33
33
  FragmentTransaction fragmentTransaction
34
34
 
35
35
  = getSupportFragmentManager().beginTransaction();
36
36
 
37
- if("tab1" == tabId){
37
+ if(tabId.equals("tab1")){
38
38
 
39
39
  fragmentTransaction
40
40
 
41
41
  .replace(R.id.real_content, new fragment1());
42
42
 
43
- }else if("tab2" == tabId){
43
+ }else if(tabId.equals("tab2")){
44
44
 
45
45
  fragmentTransaction
46
46
 
47
47
  .replace(R.id.real_content, new fragment2());
48
+
49
+ }
48
50
 
49
51
  fragmentTransaction.commit();
50
52
 

1

コード修正

2018/02/23 05:44

投稿

nobu09
nobu09

スコア34

test CHANGED
File without changes
test CHANGED
@@ -64,9 +64,9 @@
64
64
 
65
65
  Fragment fragment = TestFragment.newInstance(position+1);
66
66
 
67
- getActivity().getFragmentManager().beginTransaction().beginTransaction()
67
+ getActivity().getFragmentManager().beginTransaction()
68
68
 
69
- .replace(R.id.fragment, fragment)
69
+ .replace(R.id.real_content, fragment)
70
70
 
71
71
  .addToBackStack(null)
72
72