Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7975005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:31:54+00:00 2026-06-04T08:31:54+00:00

In my app I have tab menu : Add tab,View tab. in Add tab:

  • 0

In my app I have tab menu : Add tab,View tab.

in Add tab: I add data to database
in View tab: I select data from database into listview

now I have problem: when I add a data from add tab and switch into viewtab I can’t view last adding into database, but if I close app and open it new time, i can get last adding

any idea about solve of this problem please

Code :

`view tab code:

public class ViewEvents extends Activity {

DBAdapter DB=new DBAdapter(this);

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.viewevents);

    final ListView myListView = (ListView)findViewById(R.id.MyList);

    //  final EditText myEditText = (EditText)findViewById(R.id.myEditText);

      // Create the array list of to do items
      final ArrayList<String> todoItems = new ArrayList<String>();
      final ArrayAdapter<String>  aa = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, todoItems);

       DB.open();
     Cursor c=DB.select();
      c.moveToFirst();
      Integer n=new Integer(c.getCount());

    for(int i=0;i<c.getCount();i++)
    {
         todoItems.add(0, c.getString(0));
         c.moveToNext();
    }


       // todoItems.add(0, c.getString(0));
        aa.notifyDataSetChanged();
        myListView.setAdapter(aa);








}

}

add tab code:

public View getView(int position, View convertView, ViewGroup parent) {

        ButtonHolder holder2;
        if (convertView == null) {

            holder2 = new ButtonHolder();       


            convertView = mInflater.inflate(R.layout.item, null);

            holder2.caption = (Button) convertView.findViewById(R.id.Bte);

            convertView.setTag(holder2);


        } else {

            holder2 = (ButtonHolder) convertView.getTag();

        }


        holder2.caption.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub


                TextView names = holderpartner.caption;
                TextView date = holderdv.caption;
                TextView time = holderviewmtime.caption;
                String address = "sdfgkhj";

                event e=new event( names.getText().toString(), address,date.getText().toString(), new java.sql.Time(9, 30, 30));


                DB.open();
                DB.insertTask(e);


                date.setText("");
                time.setText("");

                Toast.makeText(getBaseContext(), "Done",Toast.LENGTH_LONG).show();

            }
        });`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:31:55+00:00Added an answer on June 4, 2026 at 8:31 am

    Add addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); flag to your intent in your TabHostActivity, so everytime you select your tab it’s content gets refreshed. Do something similar to this :

    intent = new Intent().setClass(this, Notices.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            spec = tabHost.newTabSpec("notices").setIndicator(getString(R.string.notices),
                    res.getDrawable(R.drawable.ic_tab_notices))
                .setContent(intent);
            tabHost.addTab(spec);
    

    In my situation it’s working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a facebook page tab app for my website and now I
I have a flash app embedded in a yui TabView tab div, the problem
I have created tab app.. now I am playing with screen rotation. I tried
In my app I have a tab bar. And in some views I as
I have Page Tab App, which has a landing page with a Log In
I have a tab-based iPhone app where I want to increase the perceived start-up
I have a tab-bar and navigation controller application (like Youtube app or Contacts app).
I have a small tab on an app that allows user to lookup a
I have an app, which has a top navigation bar and a bottom tab
Basically for a Facebook tab I have a PHP app and want Heroku to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.