Android
- 6 ответов
- 0 вопросов
6
Вклад в тег
public String getSomeKey1() {
return "5";
}
public String getSomeKey2() {
long key[32];
key[0] = 9;
key[2] = 55;
a = (key[0] + key[2]) * 3;
key[1] = (a % 10) + someFunc() * 99;
key[4] = (a / 10) * someFunc2() / someFunc3();
if (someFunc4()) {
key[5] = someFunc5();
} else {
key[5] = someFunc6();
}
key[6] = Integer.valueOf(getSomeKey1());
key = process1(key);
key[2] = getSomeKey3();
// ...
StringBuilder sb = new StringBuilder();
for (long i: key) {
sb.append(i);
}
return sb.toString();
}
public long[] process1(long[] key) {
key[3] = (key[4] + key[5] + key[1]*2) / 5;
key[1] = getSomeKey();
// ...
}
public long getSomeKey3() {
long a = 435345435;
boolean b = false;
while (!b) {
b = true;
for (i=2; i<(long)Math.sqr(a); i++) {
if (a % i == 0) {
b = false;
break;
}
}
a++:
}
return a+10;
}
// Итоговый мастер-ключ получаем так:
String masterKey = getSomeKey4() + getSomeKey2() + Integer.valueOf(getSomeKey1());
"Make sure the content of your adapter is not modified from a background thread, but only from the UI thread."
@Override
protected Void doInBackground(Void... params) {
LINK = "here is link for json";
obj = Helpers.getJson(LINK);
if (obj != null) {
Helpers.refreshListView(obj, tempList);
}
return null;
}
protected Void doInBackground(Void... params) {
// ...
publishProgress(new MyProgress(obj, tempList));
// ...
}
protected void onProgressUpdate(MyProgress... progress) {
if (progress.size() > 0) {
Helpers.refreshListView(progress[0].getObj(), progress[0].getTempList());
}
}
public class LoadWall extends AsyncTask<Void, MyProgress, Void> {
// ...
@Override
protected Void doInBackground(Void... params) {
// ...
publishProgress(new MyProgress(obj, tempList));
// ...
}
@Override
protected void onProgressUpdate(MyProgress... progress) {
if (progress.size() > 0) {
Helpers.refreshListView(progress[0].getObj(), progress[0].getTempList());
}
}
// ...
}
/**
* Используется для передачи прогресса в UI-Thread
*/
public class MyProgress {
private final Object obj;
private final ArrayList<LinkedHashMap<String, String>> tempList;
public MyProgress(Object obj, ArrayList<LinkedHashMap<String, String>> tempList) {
this.obj = obj;
this.tempList = tempList;
}
public Object getObj() {
return obj;
}
public ArrayList<LinkedHashMap<String, String>> getTempList() {
return tempList;
}
}