TabHost remove Tab

by Ahmy » Mon, 16 Jun 2008 12:04:32 GMT


Sponsored Links
 Hello all

I'm successfully create a tab using TabHost and TabHost.TabSpec.
i found an addTab method but not removeTab.
there is also clearAllTabs(boolean).  but that will remove all the
tab;
is there any way to remove tab by its tag name ?

oh and i created the tab programatically or by code.

thanx b4,

--~--~---------~--~----~------------~-------~--~----~



TabHost remove Tab

by Josh Guilfoyle » Thu, 19 Jun 2008 10:02:31 GMT


 You can't currently.  I don't believe this is an inherent deficiency
in the design of TabHost, but rather that you ought not construct a UI
that behaves this way.  You are presuming to reveal a tab to the user
and then hide it through some event.  Will this be extremely clear to
your user why they have lost functionality?  Perhaps disabling tabs
makes more sense for your UI, or designing separate activities
entirely.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


TabHost remove Tab

by Ahmy » Tue, 24 Jun 2008 19:20:11 GMT


 mm.. basically im creating a client messenger. the tab reveal when
user wants to chat to some user.
and the tab close when user no longer want to see the chat window.
the reason im doing this is because i just wanted a single activity.
and its only for testing my client messenger library.
single activity can reduce the complexity because the activity only
for a sample of how using this library.

thanks any way




--~--~---------~--~----~------------~-------~--~----~



TabHost remove Tab

by Mark Murphy » Tue, 24 Jun 2008 23:03:50 GMT


 


Have you tried removeView() on both the TabHost and TabWidget? That 
method should be available on both, since they inherit from ViewGroup. 
Calling it to remove the tab details and the tab itself from the host 
and widget, respectively, might do the trick.

If that doesn't work -- and I hate to sound like a broken record here -- 
  you could "roll your own" tab-like view using ViewFlipper, where 
removeView() should work.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Warescription: All titles, revisions, & ebook formats, just $35/year

--~--~---------~--~----~------------~-------~--~----~



TabHost remove Tab

by Guillaume Perrot » Wed, 25 Jun 2008 00:16:17 GMT


 I had the same problem.
I used removeViewAt(int position) on the TabWidget and it worked for
me.
The same didn't work directly on TabHost (ArrayOutOfBoundException).






--~--~---------~--~----~------------~-------~--~----~



TabHost remove Tab

by Guillaume Perrot » Wed, 25 Jun 2008 21:06:46 GMT


 In fact it seems to have side-effects to use
myTabHost.getTabWidget().removeViewAt().
I have two tabs : A B
I delete B, i add C (at the end).
When clicking on C (the indicator is good), i see B's content which
was removed !
When adding tab D at the end, i see C's content !
And so on...
I think it's currently impossible to remove a tab making TabHost
completely useless for creating a IM application... I'm gonna think of
a different way to build my UI (like using buttons to replace tabs and
switching the view when clicking on a button).





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Translate animation in android1.5

Hi,
Could anyone tell me how to smoothen  the translate animation in
android1.5





Thanks,
rakesh
--~--~---------~--~----~------------~-------~--~----~

2. Cannot Decode Images from sdcard using BitmapFactory.Options

Hi,

I am tring to get a image from the images stored on the sdcard of my
Android

but i am getting a skia error using BitmapFactory

When I just take the image directly without using BitmapFactory class
I get the image.

But the purpose of using BitmapFactory is scaling down the image size
by using inSample =4;

but I get skia as the error

Here is my code after which the logcat details are also given



Java:
public class bitD extends Activity {
     private int SELECT_IMAGE = 200;

     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);

          startActivityForResult(new Intent(Intent.ACTION_PICK,
 
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),
                    SELECT_IMAGE);
     }

     @Override
     protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == SELECT_IMAGE) {
               if (resultCode == Activity.RESULT_OK) {

                    Uri selectedImage = data.getData();

                    System.out.println("Uri of the selected img is "
                              + selectedImage);

                    try {
                         InputStream is = getContentResolver
().openInputStream(
                                   selectedImage);

                         BitmapFactory.Options opts = new
BitmapFactory.Options();
                         Bitmap bm;

                         opts.inJustDecodeBounds = true;
                         bm = BitmapFactory.decodeStream(is, null,
opts);

                         System.out.println("ht" + opts.outHeight);
                         System.out.println("wt" + opts.outWidth);
                         System.out.println("mime" +
opts.outMimeType);

                         opts.inJustDecodeBounds = false;
                         opts.inDither = true;
                         opts.inPreferredConfig =
Bitmap.Config.RGB_565;
                         // this will resize the bm
                         opts.inSampleSize = 4; // scaled down by 4
                         bm = BitmapFactory.decodeStream(is, null,
opts);

                         setContentView(R.layout.main);
                         ImageView iv1 = (ImageView) findViewById
(R.id.ImageView01);
                         iv1.setImageBitmap(bm);

                    } catch (FileNotFoundException e) {
                         // TODO Auto-generated catch block
                         e.printStackTrace();
                    }

               }

          }
     }




Here is the ouput of my logcat


06-19 12:01:21.140: DEBUG/SurfaceFlinger(56): Screen about to return,
flinger = 0x127c58
06-19 12:01:21.350: DEBUG/dalvikvm(316): GC freed 875 objects / 48416
bytes in 89ms
06-19 12:01:21.450: DEBUG/dalvikvm(316): GC freed 148 objects / 5720
bytes in 88ms
06-19 12:01:21.560: DEBUG/dalvikvm(316): GC freed 23 objects / 1064
bytes in 87ms
06-19 12:01:21.780: DEBUG/KeyguardViewMediator(56): pokeWakelock(5000)
06-19 12:01:22.870: VERBOSE/ImageGallery2(316): /
ImageBlockManager.onPause
06-19 12:01:22.890: INFO/System.out(2551): Uri of the selected img is
content://media/external/images/media/34
06-19 12:01:22.960: INFO/System.out(2551): ht1536
06-19 12:01:22.960: INFO/System.out(2551): wt2048
06-19 12:01:22.970: INFO/System.out(2551): mimeimage/jpeg
06-19 12:01:22.970: DEBUG/skia(2551): xxxxxxxxxxx jpeg error 53 Not a
JPEG file: starts with 0x%02x 0x%02x
06-19 12:01:23.080: INFO/ActivityManager(56): Displayed activity
co.pad.BD/.bitD: 14010 ms
06-19 12:01:28.200: DEBUG/dalvikvm(163): GC freed 1543 objects / 79424
bytes in 108ms
06-19 12:01:33.170: DEBUG/dalvikvm(180): GC freed 91 objects / 4840
bytes in 77ms
06-19 12:01:38.200: DEBUG/dalvikvm(316): GC freed 790 objects / 35944
bytes in 103ms


Please someone help me out ........

Is there a work around / can i do this differently without consuming a
lot of memory(I do not want to end up with Out of Memory Error.)


Thanks in Advance.
--~--~---------~--~----~------------~-------~--~----~

3. FLAG_ACTIVITY_NEW_TASK why is it required in onRecieve when starting activity

4. how to close activity?

5. drawRect not doing anything in a 1.5 MapView

6. WebView highlight link border

7. Is learning Java directly on the Android possible or a good idea?