Android类名出现错误
package com.example.myapplication;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* Created by Administrator on 2017/5/6.
*/
public class FirstFragment extends Fragment {
private String context;
private TextView mTextView;
public FirstFragment(String context){
this.context = context;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.first_fragment,container,false);
mTextView = (TextView)view.findViewById(R.id.txt_content);
//mTextView = (TextView)getActivity().findViewById(R.id.txt_content);
mTextView.setText(context);
return view;
}
}
这是源码,老是出现
This fragment should provide a default constructor (a public constructor with no arguments) (com.example.myapplication.FirstFragment) less... (Ctrl+F1)
From the Fragment documentation: Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with setArguments(Bundle) and later retrieved by the Fragment with getArguments().
什么意思
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* Created by Administrator on 2017/5/6.
*/
public class FirstFragment extends Fragment {
private String context;
private TextView mTextView;
public FirstFragment(String context){
this.context = context;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.first_fragment,container,false);
mTextView = (TextView)view.findViewById(R.id.txt_content);
//mTextView = (TextView)getActivity().findViewById(R.id.txt_content);
mTextView.setText(context);
return view;
}
}
这是源码,老是出现
This fragment should provide a default constructor (a public constructor with no arguments) (com.example.myapplication.FirstFragment) less... (Ctrl+F1)
From the Fragment documentation: Every fragment must have an empty constructor, so it can be instantiated when restoring its activity's state. It is strongly recommended that subclasses do not have other constructors with parameters, since these constructors will not be called when the fragment is re-instantiated; instead, arguments can be supplied by the caller with setArguments(Bundle) and later retrieved by the Fragment with getArguments().
什么意思
...全文
相关推荐
Android开发遇到的小问题总结,不断更新
三、 Android 开发中类名冲突的问题在 Android 开发中,我们经常会遇到类名冲突的问题,例如自己定义的类和 Android 中内置的类同名时,无法调用安卓自带的类中的方法。
Android日志打印类LogUtils,能够定位到类名,方法名以及出现错误的行数并保存日志文件
版权声明:本文为寻梦-finddreams原创文章,请关注:http://blog.csdn.net/finddreams https://blog.csdn.net/finddreams/article/details/45569089 关注finddream...
安卓应用软件
**修复错误**:导入后,Eclipse可能会显示一些错误,因为引用的包名和类名现在需要与新的工程结构匹配。通过Eclipse的自动修复功能,或者手动修改错误,确保所有引用都指向正确的类和包。10.
android安卓加固反调试(最全).pdf
伪加密通过改变文件特定部分的字节来实现,而超长类名可以导致解析错误。
安卓Android源码——完整版android视频播放器.rar
【标签】中的“安卓”和“android源码”强调了这与Android操作系统和其开发环境有关。


