android-The method findViewById(int) is undefined for the type ContactMainFragment报错

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        mTitleNameView = (TextView) findViewById(R.id.ivTitleName);
        mTitleNameView.setVisibility(View.VISIBLE);
        mTitleNameView.setText(R.string.company_name);

提示:意思应该是提示找不到相应组件而得不到组件ID

解决方法:加上view.即可

mTitleNameView = (TextView) view.findViewById(R.id.ivTitleName);
时间: 2024-08-01 09:25:46

android-The method findViewById(int) is undefined for the type ContactMainFragment报错的相关文章

The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the

 The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String) 今天遇到这样一个很奇葩的错误信息,后来查到我导入的包有问题  import android.app.Fragment; import android.app.FragmentManager;   其实我应该使用的

The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

An error occurred at line: 23 in the generated java file The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) org.a

The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments

The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments (String, new   View.OnClickListener(){}) .setNegativeButton("Don't Remind", new OnClickListener() .setNegative

报错:An error occurred at line: 22 in the generated java file The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 22 in the generated java file The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory 加入Myeclipse自带的java EE 6 library即可解决:

解决Undefined symbols for architecture x86_64: 报错 和 ld: warning: ld: warning: ignoring file警告

出现这种错误的情况: 用iphone5模拟器编译程序正常, 用iphone5s以上的模拟器编译出现Undefined symbols for architecture x86_64: 报错 和 ld: warning: ld: warning: ignoring file警告, 用真机编译正常... 网上找了很多解决方法都没办法解决..都是说更改bulid setting的一些相关设置..然后都木有什么卵用... 这里附上我的解决方法..其实也不是很麻烦...(我没有更改bulid settin

Android(java)学习笔记116:PC_Phone通信程序报错

1.首先我写的程序代码如下: 1 package com.himi.udpsend; 2 3 import java.net.DatagramPacket; 4 import java.net.DatagramSocket; 5 import java.net.DatagramSocketImpl; 6 import java.net.InetAddress; 7 import java.net.SocketException; 8 import java.net.UnknownHostExce

Android(java)学习笔记125:Clock app编写报错02

1.首先之间看错误: 07-13 10:07:55.354: E/AndroidRuntime(8008): FATAL EXCEPTION: main 07-13 10:07:55.354: E/AndroidRuntime(8008): java.lang.NullPointerException 07-13 10:07:55.354: E/AndroidRuntime(8008): at com.himi.clock.AlarmActivity.onClick(AlarmActivity.

Android(java)学习笔记123:Clock app编写报错

1.首先我们二话不说直接先看报错内容如下: 07-12 08:25:03.572: E/dalvikvm(3602): native fork pid:0 done. 07-12 08:25:03.582: E/dalvikvm(3602): threadid=6: created from interp,name=ReferenceQueueDaemon 07-12 08:25:03.582: E/dalvikvm(3602): threadid=6: calling run(),name=R

Android开发时,sqlite创建表成功,insert不报错,但没有数据插入的原因

在android开发过程中,经常要通过sqlite来存储一些数据,这种应用应该是再平常不过了,但是有时难免一时疏忽,就会出现sqlite创建表成功,insert不报错,但没有数据插入. 具体问题详见如下代码: Context ctx;        SQLiteDatabase db = dbOpenHelper.getWritableDatabase(); // 开启事务        db.beginTransaction();        try{                // 数