سلام
وقتی به انتهای لیست ویو میرسیم میخوام که پست ها به صورت اتوماتیک لود بشن مثلا هر 10 تا 10
من از دیتابیس sqlite استفاده میکنم خیلی هم ور رفتم ولی نتونستم درست کنم و آموزشهای نت هم کلی گشتم و. .. ولی نشد
این اکتیویتی اصلیمه :
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();
}
}
همه چی داخل همین اکتیویتی اصلی هستش
لطفا راهنمایی کنید :قلب: