小编Hei*_*sis的帖子

随机文本文件Delphi源或其他任何东西

我有一个包含10,000个条目的字符串列表.我有一个shuffle例程,但访问任何项目需要花费很多时间.浏览所有10k项目需要花费大量时间.

我想保存它做磁盘然后使用另一种方法对文件进行洗牌.

有什么建议?

delphi performance tstringlist text-files

3
推荐指数
1
解决办法
1179
查看次数

不适用于参数

我正在尝试在选择首选项时显示进度消息:

        Preference prefLocation = (Preference) findPreference("location");
    prefLocation.setOnPreferenceClickListener(new OnPreferenceClickListener() {

        public boolean onPreferenceClick(Preference preference) {
            ProgressDialog pDialog = ProgressDialog.show(this, "Location" , "Finding location...", true);
            return true;
        }
    });
Run Code Online (Sandbox Code Playgroud)

但是我在Eclipse中遇到错误:

The method show(Context, CharSequence, CharSequence, boolean) in the type ProgressDialog is not applicable for the arguments (new Preference.OnPreferenceClickListener(){}, String, String, boolean)
Run Code Online (Sandbox Code Playgroud)

但是,当我在setOnPreferenceClickListener之前执行该行时,它编译得很好!

我可能已经揭示了我在Java方面的严重缺乏经验,但是会找到一条线索!

java android

2
推荐指数
1
解决办法
3700
查看次数

Java:类型转换问题

有没有办法在一行中做到这一点:

    TextView tv = (TextView) findViewById(R.id.lbSightName);
    tv.setText("Some Text");
Run Code Online (Sandbox Code Playgroud)

我想做声明中介电视,像这样:

(TextView) findViewById(R.id.lbSightName).setText("Some Text");
Run Code Online (Sandbox Code Playgroud)

不可能?

java casting

0
推荐指数
1
解决办法
961
查看次数

如何修改基于Char的加密代码以使用Unicode Delphi?

我试图在Delphi XE2中使用一些传统的Delphi 2007代码.

Function EncryptionWithPassword(Str,Pwd: AnsiString; Encode: Boolean): AnsiString;
var
  a,PwdChk,Direction,ShiftVal,PasswordDigit : Integer;
begin
  PasswordDigit := 1;
  PwdChk := 0;
  for a := 1 to Length(Pwd) do Inc(PwdChk,Ord(Pwd[a]));
  Result := PChar(Str);
  If Encode then Direction := -1 else Direction := 1;
  for a := 1 to Length(Result) do
    begin
      if Length(Pwd)=0 then
        ShiftVal := a
      else
        ShiftVal := Ord(Pwd[PasswordDigit]);
      if Odd(A) then
        Result[A] := RotateBits(Result[A],-Direction*(ShiftVal+PwdChk))
      else
        Result[A] := RotateBits(Result[A],Direction*(ShiftVal+PwdChk));
      inc(PasswordDigit);
      if PasswordDigit > Length(Pwd) then PasswordDigit := 1;
    end;

end; …
Run Code Online (Sandbox Code Playgroud)

delphi unicode

-1
推荐指数
1
解决办法
341
查看次数