首页 \ 问答 \ 成都网站建设公司哪家好一些?

成都网站建设公司哪家好一些?

本人是成都的,想找一个做网站做的比较好的成都网站建设公司,大家推荐吗?
更新时间:2022-08-10 16:08

最满意答案

您必须先在某处初始化ArrayList实例,然后才能像这样实际添加值

public ArrayList<TextView> Durations = new ArrayList<TextView>();
public ArrayList<Long> periods = new ArrayList<Long>();

直接来自文档,

什么时候抛出NullPointerException?

当应用程序在需要对象的情况下尝试使用null时抛出。 这些包括:

  • 调用null对象的实例方法。
  • 访问或修改空对象的字段。 将null的长度视为数组。
  • 访问或修改null的插槽,就像它是一个数组一样。
  • 抛出null,好像它是一个Throwable值。

You have to initialize the ArrayList instances somewhere before you can actually add values to it like this

public ArrayList<TextView> Durations = new ArrayList<TextView>();
public ArrayList<Long> periods = new ArrayList<Long>();

Directly from the documentation,

When NullPointerException is thrown?

Thrown when an application attempts to use null in a case where an object is required. These include:

  • Calling the instance method of a null object.
  • Accessing or modifying the field of a null object. Taking the length of null as if it were an array.
  • Accessing or modifying the slots of null as if it were an array.
  • Throwing null as if it were a Throwable value.

相关问答

更多
  • 您必须先在某处初始化ArrayList实例,然后才能像这样实际添加值 public ArrayList Durations = new ArrayList(); public ArrayList periods = new ArrayList(); 直接来自文档, 什么时候抛出NullPointerException? 当应用程序在需要对象的情况下尝试使用null时抛出。 这些包括: 调用null对象的实例方法。 访问或修改空对象的字段。 将 ...
  • 尝试 span.setSpan(new RelativeSizeSpan(0.8f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Try span.setSpan(new RelativeSizeSpan(0.8f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  • 使用TextUtils.isEmpty if(TextUtils.isEmpty(data.getName())){ viewHolder.mName.setVisibility(GONE); }else{ viewHolder.mName.setVisibility(VISIBLE); } if(TextUtils.isEmpty(data.getNameTwo())){ viewHolder. mNameTwo.setVisibility(GONE); }else{ viewHolder.mNa ...
  • 你可以这样做; 直接在for循环中使用pathName ... desk.setText(""); for (int j = 0; j < pathName.size(); j++){ desk.append("Deskripsi:\n" + pathName.get(j) + "\n"); } You can do this instead; use pathName directly in the for loop... desk.setText(""); for (int j = 0; j ...
  • 缺少textView.setText("SomeText") 你应该做这个 yourTextView.setText(textItem.getDescription) 你也在循环中为同一个textview分配了很多值,这是错误的,你会有一个textItems显示 码 import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; public class ...
  • 请使用Context of activity作为ArrayAdapter的第一个参数,您可以使用 ActivityName.this而不是this ,其中ActivityName是活动类的名称。 看来你正在运行这个代码,在一些Runnable或Thread类中,所以现在, this是一个Runnable对象的实例。 Please use Context of activity as the first parameter of the ArrayAdapter, you can use ActivityNa ...
  • 不要混淆。 List> outerlist = new ArrayList>(outCapacity); 和 ArrayList innerList= new ArrayList(InnCapacity); // adding some elements to innerlist as well. 现在 outerList.add(innerList); 所以你只是增加了outerlist和inn ...
  • 实际上你需要添加一个布局(视图),其中textView1将在那里例如试试这个: setContentView(R.layout.x1); 所以你的代码就是这样 public class settext extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.x1); TextV ...
  • 你为什么不在xml中使用ScrollView将更容易打开ScrollView打开一个布局设置它你想要它是如何水平或垂直放入你的TextViews然后先关闭布局然后ScrollView和Voila完成.. What I did to solve my problem: textView.post(new Runnable() { @Override public void run() { textHeight = textViews.getLi ...
  • 尝试这样的事情......你可以摆脱Arraylists。 记住一个字符串基本上是一个字符数组。 创建一个实现runnable的自定义文本视图,以便在主线程上完成您尝试对文本执行的工作。 package com.example.stackquestion; import java.util.ArrayList; import android.content.Context; import android.graphics.Color; import android.os.SystemClock; imp ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。