首页 \ 问答 \ FirebaseUI NoSuchMethodException:(FirebaseUI NoSuchMethodException:)

FirebaseUI NoSuchMethodException:(FirebaseUI NoSuchMethodException:)

我只是分享相关代码:

主要活动:

 RecyclerView recyclerView;

        DatabaseReference databaseReference;




    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_todo);
        Firebase.setAndroidContext(this);


        databaseReference = FirebaseDatabase.getInstance().getReference();

        recyclerView = (RecyclerView) findViewById(R.id.list);
        recyclerView.setHasFixedSize(true);



        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);





        FirebaseRecyclerAdapter<Grupo,GruposAdapter.ViewHolder> adapter =
                new FirebaseRecyclerAdapter<Grupo, GruposAdapter.ViewHolder>(
                    Grupo.class,
                        R.layout.item,
                        GruposAdapter.ViewHolder.class,
                        databaseReference.child("Grupos")


        ) {
            @Override
            protected void populateViewHolder(GruposAdapter.ViewHolder viewHolder, Grupo model, int position) {
                    viewHolder.id.setText(String.valueOf(model.getId()));
                    viewHolder.grupo.setText(model.getGroupname());
            }
        };



        recyclerView.setAdapter(adapter);
    }

错误:

04-19 14:50:52.886 22120-22120/datos.agregar.firebase.ejemplo.com.ejemploagregardatoscffirebase E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                                                  Process: datos.agregar.firebase.ejemplo.com.ejemploagregardatoscffirebase, PID: 22120
                                                                                                                  java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]

为什么NoSuchMethodException ? 想法?

固定:

  public static class ViewHolder extends RecyclerView.ViewHolder{
        public TextView id,grupo;
        public CardView cardview;

        public ViewHolder(View itemView){
            super(itemView);

            id = (TextView) itemView.findViewById(R.id.idgrupo);
            grupo = (TextView) itemView.findViewById(R.id.grupo);
            cardview = (CardView) itemView.findViewById(R.id.cardview);
        }
    }

I just share the relevant code:

MainActivity:

 RecyclerView recyclerView;

        DatabaseReference databaseReference;




    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_todo);
        Firebase.setAndroidContext(this);


        databaseReference = FirebaseDatabase.getInstance().getReference();

        recyclerView = (RecyclerView) findViewById(R.id.list);
        recyclerView.setHasFixedSize(true);



        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.setLayoutManager(linearLayoutManager);





        FirebaseRecyclerAdapter<Grupo,GruposAdapter.ViewHolder> adapter =
                new FirebaseRecyclerAdapter<Grupo, GruposAdapter.ViewHolder>(
                    Grupo.class,
                        R.layout.item,
                        GruposAdapter.ViewHolder.class,
                        databaseReference.child("Grupos")


        ) {
            @Override
            protected void populateViewHolder(GruposAdapter.ViewHolder viewHolder, Grupo model, int position) {
                    viewHolder.id.setText(String.valueOf(model.getId()));
                    viewHolder.grupo.setText(model.getGroupname());
            }
        };



        recyclerView.setAdapter(adapter);
    }

The error:

04-19 14:50:52.886 22120-22120/datos.agregar.firebase.ejemplo.com.ejemploagregardatoscffirebase E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                                                  Process: datos.agregar.firebase.ejemplo.com.ejemploagregardatoscffirebase, PID: 22120
                                                                                                                  java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]

Why NoSuchMethodException ? ideas?

FIXED WITH:

  public static class ViewHolder extends RecyclerView.ViewHolder{
        public TextView id,grupo;
        public CardView cardview;

        public ViewHolder(View itemView){
            super(itemView);

            id = (TextView) itemView.findViewById(R.id.idgrupo);
            grupo = (TextView) itemView.findViewById(R.id.grupo);
            cardview = (CardView) itemView.findViewById(R.id.cardview);
        }
    }

原文:https://stackoverflow.com/questions/43504910
更新时间:2023-08-03 07:08

最满意答案

可以(尽管很少见) REQUEST_TIME不能设置,这可以在这里看到。

如果没有设置,我建议回到time() 。 例如。

$time = $_SERVER['REQUEST_TIME'];

if(!$time) {
    $time = time();
}

It is possible (although rare) for REQUEST_TIME to not be set, as can be seen here.

I'd recommend falling back to time() if it's not set. eg.

$time = $_SERVER['REQUEST_TIME'];

if(!$time) {
    $time = time();
}

相关问答

更多
  • 该文档说,在命令行模式下运行时,默认值为0(无限制)。 它并不是说你不能覆盖它: set_time_limit(10); // this way ini_set('max_execution_time', 10); // or this way 编辑:我只是自己试了一下,它按预期工作。 F:\dev\www>c:php -f index.php PHP Fatal error: Maximum execution time of 2 seconds exceeded in F:\dev\www\inde ...
  • 很多种方法。 一个简单的: chmod 754 /usr/bin/php chgrp php /usr/bin/php 然后只将您想要的人添加到该php组 当然,apache或web用户也应该也在该组中。 Many ways. A simple one: chmod 754 /usr/bin/php chgrp php /usr/bin/php Then add only the person you want to that php group Of course, apache or the web ...
  • 找到了! php需要'php-posix'包来输出centos中的颜色。 这是通过这个软件包安装的: php-process-7.0.12-2.el7.remi.x86_64 Found it! 'php-posix' package was needed for php to output colors in centos. This was installed via this package: php-process-7.0.12-2.el7.remi.x86_64
  • 使用php_sapi_name()函数。 if (php_sapi_name() == "cli") { // In cli-mode } else { // Not in cli-mode } 以下是文档中的一些相关注释: php_sapi_name - 返回Web服务器和PHP之间的接口类型 虽然并不详尽,但可能的返回值包括aolserver,apache,apache2filter,apache2handler,caudium,cgi(直到PHP 5.3),cgi-fcgi,cli, ...
  • 这个问题并不是特定于PHP,它适用于任何语言。 在Unix上,如果要忽略输入重定向并直接从终端读取,则可以从/dev/tty而不是标准输入读取。 function prompt_user($prompt) { $terminal = fopen("/dev/tty", "r+"); if ($terminal) { fputs($terminal, $prompt); return fgets($terminal); } } The problem ...
  • 我怎么知道它是否仍在运行? 只需设置一个新的cron作业,但让cron命令成为可以帮助你调试的东西:一个有用的命令 ps -af | grep php > /some/path/to/mylogfile.txt ps命令列出正在运行的进程的信息。 使用这些标志,输出的一部分将是启动该过程的原始linux命令,因此我们可以grep该行并查找php因为origional命令可能是这样的: php myscript.php 输出重定向到mylogfile.txt ,以便在cron作业运行后手动读取。 进程id ...
  • PHP CLI。 为这个绑定apache的资源是没有意义的。 也就是说,不能保证你的脚本不会降低你的服务器速度,因为这取决于正在执行的实际脚本。 解析一些这样的xml文件并存储它们的内容,不应该在现代硬件上造成很大的问题。 即使脚本没有高度优化。 尝试一次加载尽可能少的数据,并在使用后妥善清理使用过的资源,以减少内存消耗。 使用扩展xml解析来减少负载。 PHP CLI. It makes no sense to tie up apache's resources for this. That said, ...
  • 从终端尝试以下内容: sudo mkdir /var/log/gearman-job-server/ sudo touch /var/log/gearman-job-server/gearmand.log sudo killall gearmand sudo gearmand --log-file=/var/log/gearman-job-server/gearmand.log Try the following from the terminal: sudo mkdir /var/log/gearman ...
  • 可以(尽管很少见) REQUEST_TIME不能设置,这可以在这里看到。 如果没有设置,我建议回到time() 。 例如。 $time = $_SERVER['REQUEST_TIME']; if(!$time) { $time = time(); } It is possible (although rare) for REQUEST_TIME to not be set, as can be seen here. I'd recommend falling back to time() if ...
  • 解决方案(归功于DaveRandom)是按照以下步骤将PHP更新到5.5.1版: 下载5.5.1 Windows二进制文件。 在{wamproot} / bin / php /中创建名为“php5.5.1”的新文件夹。 将{wamproot} /wampmanager.ini中出现的所有“5.4.3”替换为“5.5.1”。 对wampmanager.conf重复步骤3 更新PATH环境变量 Solution (credit goes to DaveRandom) was to update PHP to v ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。