آموزش های این وب سایت به صورت رایگان در دسترس است. اطلاعات بیشتر
بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]

مشکل در لیست ویو

Devtpoint  11 سال پیش  11 سال پیش
0 0

سلام یه مشکل بسیار عجیب دارم و اون این هست که بعد از اینکه محصول رو ذخیره میکنم توی لیست ویو آپدیت نمیشه و برای بار اول باید حتما توی edtSearch کلمه ی مورد نظر رو بنویسم تا توی لیست ویو بالا بیاد اگه نرم افزار رو خارج کنم و بعد وارد بشم مشکلی نداره اما فقط برای بار اول بالا نمیاد  این هم کدش

 public class ActivityListview extends Activity {

public ArrayAdapter adapter;
public ListView lstContent;

@Override
protected void onResume() {

G.curentActivity = this;
if (adapter != null) {
adapter.notifyDataSetChanged();
}
super.onResume();

}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview);

ImageView imgSave = (ImageView) findViewById(R.id.imgSave);
lstContent = (ListView) findViewById(R.id.lstContent);
adapter = new ActivityAdapterNote(G.notes);
lstContent.setAdapter(adapter);

G.notes.clear();
G.readOfDB();
adapter.notifyDataSetChanged();

final EditText edtSearch = (EditText) findViewById(R.id.edtSearch);
edtSearch.addTextChangedListener(new TextWatcher() {

@Override
public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

G.notes.clear();
String input = edtSearch.getText().toString();
Cursor cursor = G.db.rawQuery("SELECT * FROM MDS WHERE mds_name LIKE '%" + input + "%'", null);

while (cursor.moveToNext()) {

StructNote item = new StructNote();

item.name = cursor.getString(cursor.getColumnIndex("mds_name"));
item.some = cursor.getLong(cursor.getColumnIndex("mds_some"));
item.vahed = cursor.getString(cursor.getColumnIndex("mds_vahed"));
item.priceVahed = cursor.getLong(cursor.getColumnIndex("mds_priceVahed"));
item.priceComplete = cursor.getLong(cursor.getColumnIndex("mds_priceComplete"));
item.hours = cursor.getInt(cursor.getColumnIndex("mds_hours"));
item.month = cursor.getInt(cursor.getColumnIndex("mds_minute"));
item.second = cursor.getInt(cursor.getColumnIndex("mds_second"));
item.year = cursor.getInt(cursor.getColumnIndex("mds_year"));
item.month = cursor.getInt(cursor.getColumnIndex("mds_month"));
item.day = cursor.getInt(cursor.getColumnIndex("mds_day"));

G.notes.add(item);
adapter.notifyDataSetChanged();

}
cursor.close();

}

@Override
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

}

@Override
public void afterTextChanged(Editable arg0) {

}
});

imgSave.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {

Intent intent = new Intent(ActivityListview.this, ActivityInsert.class);
ActivityListview.this.startActivity(intent);

}
});

}
}
 برای این سوال 1 پاسخ وجود دارد.
پاسخ به سوال 
Devtpoint  11 سال پیش
0 0


پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .