'TAG' has private access in 'android.support.v4.app.FragmentActivity'

后端 未结 4 2041
北荒
北荒 2021-02-05 04:44

Almost everything in my activity is working fine, except for wherever TAG is referenced. TAG gets a red line and says: \'TAG\' has private access

4条回答
  •  滥情空心
    2021-02-05 05:14

    Well that's just an Android's way of telling us that we haven't defined TAG. To define the TAG in the current file, we can go to MainActivity Class and type "logt", you will get some auto code suggestions from Android studio, press enter there and you will get following code

    private static final String TAG = "MainActivity";
    

    Once you add this to your code, your error will be gone

提交回复
热议问题