Need Android tabhost back press navigation
<p>Friend's,
     I implemented tabhost in my application,i have three tabs defined in my activity tab1,tab2,tab3...here i have a problem to navigate from tab3 to tab1 at onkey back pressed event ,how can i reach the tab1 from tab3 and tab2,i tried up using overided keyback pressed,but it some times it's not responding to navigate.without overriding onkey back pressed it simply exits from application.</p>

<p>Here my code </p>

<pre><code>tabHost= getTabHost();

        tabHost.addTab(tabHost.newTabSpec("tab1").setContent(
                new Intent(this, DealCities.class)).setIndicator(prepareTabView("Deals",R.drawable.test)));

        tabHost.addTab(tabHost.newTabSpec("tab2").setContent(new Intent(this, DbServerActivity.class))
                        .setIndicator(prepareTabView("My QuadDeals",R.drawable.mydeal)));

        tabHost.addTab(tabHost.newTabSpec("tab3").setContent(new Intent(this, Account.class))
                .setIndicator(prepareTabView("My Account",R.drawable.img_myaccount)));
</code></pre>

<p>here the tabhost defined in one class and the tabhost object being static one,</p>

<p>here the code from my tab2 back pressed event  has follows,</p>

<pre><code> @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; event.getRepeatCount() == 0) {

            try {               
//              userdealList.setVisibility(View.GONE);              
//              logalertTable.setVisibility(View.GONE);
//              dealType.setVisibility(View.GONE);
//              mydealBack=1;
//              QuadMain.tabHost.setCurrentTab(0);  
                Intent i = new Intent();
                i.setClass(DbServerActivity.this, QuadMain.class);
                i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(i);

            } catch (Exception e) {

            }
            return true;
        }

        return super.onKeyDown(keyCode, event);
    }
</code></pre>

<p>it works fine sometimes only and sometimes it's not working..</p>

<p>Thanks in advance.</p>
