小编Ale*_*ex 的帖子

非静态方法getIntent()不能从静态上下文中引用

我收到错误:

Error:(109, 18) error: non-static method getIntent() cannot be referenced from a static context
Run Code Online (Sandbox Code Playgroud)

在线上:

init(getIntent().getSerializableExtra(Const.EXTRA_DATA)); 
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

public static class Upper_fragment extends Fragment {

        private static final String TAG = "PlayActivity";

        private Video vid;
        int mSavedVideoPosition;
        protected VideoPlayerInterface vidp;
        private LocalSingleHttpServer mServer;


        // to be implemented in concrete activities
        public Cipher getCipher() throws GeneralSecurityException {
            final Cipher c = Cipher.getInstance("AES");    // NoSuchAlgorithmException, NoSuchPaddingException
            c.init(Cipher.DECRYPT_MODE, new SecretKeySpec("abcdef1234567890".getBytes(), "AES"));    // InvalidKeyException
            return c;
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle …
Run Code Online (Sandbox Code Playgroud)

android

0
推荐指数
1
解决办法
2468
查看次数

标签 统计

android ×1