如何解决:属性参数必须是常量表达式错误?

时间:2016-07-15 10:23:00

标签: c# asp.net-mvc validation data-annotations

我正在尝试对两个字段执行基本比较验证 - 密码和确认密码。

对于错误消息,我调用了对errormsg的获取值的引用。 如果我使用,我会收到以下错误

  

属性参数必须是属性参数类型

的常量表达式,typeof表达式或数组创建表达式
ShareDialog shareDialog;
String PATH;
String link , img_txt;
private ImageLoader imageLoader;
private Context context;
String url1;
CallbackManager callbackManager;
File file1;
List<ImgModel> listmodel;
    public ImageAdapter(List<ImgModel> listmodel, Context context) {
    super();
    this.listmodel = listmodel;
    this.context = context;
    setHasStableIds(true);  //added  15/7/2016
}
   @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v = LayoutInflater.from(parent.getContext())
        .inflate(R.layout.img_row, parent, false);
     ViewHolder viewHolder = new ViewHolder(v);
    return viewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {

    ImgModel model = listmodel.get(position);
    imageLoader = CustomVolleyRequest.getInstance(context).getImageLoader();
    imageLoader.get(model.getImageUrl(), ImageLoader.getImageListener(holder.imageView, R.drawable.placeholder, android.R.drawable.ic_dialog_alert));
    holder.imageView.setImageUrl(model.getImageUrl(), imageLoader);
    holder.textViewName.setText(model.getName());
    holder.imageView.setOnLongClickListener(new View.OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
        link = listmodel.get(position).getImageUrl();
        img_txt = listmodel.get(position).getName();
        String fileExtension = link.substring(link.lastIndexOf("/"));
        Log.e("0_0","===>"+fileExtension);
        String dir = Environment.getExternalStorageDirectory() + "/Download/myapp/";
         file1 = new File(dir+fileExtension);
        Log.d("file is ","longclick"+file1);
        if (file1.exists()) {
            Intent shareIntent = new Intent();
            shareIntent.setAction(Intent.ACTION_SEND);
            shareIntent.setType("image/jpg");
            shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(String.valueOf(file1))));
            shareIntent.putExtra(Intent.EXTRA_TEXT, img_txt);
            context.startActivity(Intent.createChooser(shareIntent, "Share image with"));
        } else {
            new DownloadFile().execute(link);
        }
        return true;
    }
    });
    holder.imageView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
    url1 = listmodel.get(position).getImageUrl();
    Log.e("Hey Amit", "second is url" + url1);
    Imagefull();
    }
    });
    }
@Override
public int getItemCount() {
     return listmodel.size();
     }

public long getItemId(int position) {
    return position;
}

 class ViewHolder extends RecyclerView.ViewHolder {
  public NetworkImageView imageView;
  public TextView textViewName;

  public ViewHolder(View itemView) {
    super(itemView);
    imageView = (NetworkImageView) itemView.findViewById(R.id.imageView_img);
    textViewName = (TextView) itemView.findViewById(R.id.textview_img);
    callbackManager = CallbackManager.Factory.create();
    }
}

0 个答案:

没有答案