0
投稿が自動的に読み込まれるようにするリストビューの最後に到達すると、たとえば10ずつ読み込まれます。 私はsqliteデータベースを使用しています。この問題を修正するために、私はこのことについてインターネット上の教育機関の投稿を見ています。とても大変でしたが、残念ながら私はそれをやりません。 これはandroidの記事を自動読み込みする方法
public class MainActivity extends ListActivity {
private database db;
private String[] Name;
private String[] Teedad;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = new database(this);
db.useable();
refresher();
setListAdapter(new AA());
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
ProgressDialog pd = new ProgressDialog(this);
pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTA L);
pd.setMessage("لطفا کمی صبر کنید ...");
pd.setCancelable(true);
pd.setProgress(0);
pd.show();
Intent intent = new Intent(MainActivity.this, storys.class);
intent.putExtra("season", Name[position]);
MainActivity.this.startActivity(intent);
pd.setProgress(100);
}
class AA extends ArrayAdapter<String> {
public AA() {
super(MainActivity.this, R.layout.raw_seasone, Name);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater in = getLayoutInflater();
View row = in.inflate(R.layout.raw_seasone, parent, false);
TextView name = (TextView) row.findViewById(R.id.name_season);
TextView teedad = (TextView) row.findViewById(R.id.teedad_dastan);
name.setText(Name[position]);
teedad.setText(Teedad[position]);
return (row);
}
}
private void refresher() {
db.open();
int save = db.shomaresh_field("datastorys", "season");
Name = new String[save];
Teedad = new String[save];
for (int i = 0; i < save; i++) {
Name[i] = db.namayesh_fasl("datastorys", i);
Teedad[i] = db.shomaresh_dastan("datastorys", Name[i].toString()) + "";
}
db.close();
}
}
私の主な活動であるすべての必要な事項は、あなたがあなたのリストビューのオフセットプロパティを使用する必要があり、この活動に
リストを養うために参照している:
あなたは、このようにそれを行うことができますか? –
コードではどこが10で10ですか?必要ならば、_LIMIT_ – Piyush