插入数据库完成后或在Android后退按钮上重新加载列表视图

时间:2015-10-31 09:36:54

标签: android listview onresume

大家好我真的坚持这个,我很感激帮助。我正在插入一个mysql数据库,当我在按钮内完成时,我正在呼叫完成,它会回到主要活动,但列表不刷新?我尝试了OnResume和onRestart,但列表根本没有显示?

这是我的插入按钮(主要活动称为businessSide.java)

 //Add offer when button is clicked  and send  business id and business email to business side
        Button button = (Button) findViewById(R.id.btnOffer);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String serverURL = "http://10.0.2.2/Codes/AddOffer.php";
                offerName = editNameText.getText().toString();
                offerLocation = editLocationText.getText().toString();
                offerDescription = editDescriptionText.getText().toString();
                offerType=type;
                Intent i = getIntent();
                businessId = i.getStringExtra("number");
                businessEmail = i.getStringExtra("email");


                new SummaryAsyncTask().execute((Void) null);
                Toast.makeText(getApplicationContext(), "You have successfully placed a new offer ", Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(Add_offer.this,BusinessSide.class);
                intent.putExtra("number", id);
                intent.putExtra("email", businessEmail);
                startActivity(intent);
                finish();
            //    onBackPressed();

            }
        });
    }

0 个答案:

没有答案