我有一个包含10,000个条目的字符串列表.我有一个shuffle例程,但访问任何项目需要花费很多时间.浏览所有10k项目需要花费大量时间.
我想保存它做磁盘然后使用另一种方法对文件进行洗牌.
有什么建议?
我正在尝试在选择首选项时显示进度消息:
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方面的严重缺乏经验,但是会找到一条线索!
有没有办法在一行中做到这一点:
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)
不可能?
我试图在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 ×2
java ×2
android ×1
casting ×1
performance ×1
text-files ×1
tstringlist ×1
unicode ×1