Android : Switch Activity Of Content Of Tab In Tabhost?

Dec 8, 2009

I have created a TabHost and in 1 of the tab, I have added the content using

mTabHost.addTab(mTabHost.newTabSpec("tab1")
.setIndicator(getString(R.string.dialerIconLabel),
getResources().getDrawable(R.drawable.ic_tab_dialer))
.setContent(intent));

Is it possible for me to switch the content's activity programatically after I called 'addTab of TabHost'?

Android : Switch activity of content of tab in Tabhost?


Android :: Trap In TabHost When AsyncTask Delays Set Content View At Activity Startup

Nov 3, 2009

I've got a tab host activity started from a home screen shortcut. When my application starts it downloads information from a server using an AsyncTask. In the onPostExecute method of the AsyncTask I call setContentView to display the TabHost.When I start the homescreen shortcut by tapping on the shortcut using my finger everything works as expected, I download the information from the server and display the TabHost with the information in the tabs. However starting the application by navigating to the shortcut with the mouse wheel and then clicking on the shortcut with the mouse wheel leads to a trap in the framework code as soon as my application starts. This looks like a simple fix since mCurrentView is null at the time that this method is called - can this issue be addressed? Does anyone know of any workarounds?

View 5 Replies View Related

Android :: Clear Completely Whole TabHost And Replace With Other Content?

May 9, 2010

I have a code for populating content for tabs dynamically. First time it works ok, but when I want to replace tabs (and their content) with new content - tabs are changed but tabs' contents are not, how can I clear completely whole TabHost and replace with other content? code...

View 2 Replies View Related

Android :: Replace Existing TabHost Content / Activities?

Nov 16, 2009

Since the TabHost API does not offer a way to change existing views or activities, what is the preferred means to replace an existing tab?

I only know of: clearing the tabs and adding them again. Is there an alternative? Or is this really not provided by design?

View 2 Replies View Related

Android : Restart An Activity Within A Tabhost?

Jan 13, 2010

I've searched and I know it seems some people frown upon using activities within tabs, but moving past that...how would I restart a tabbed activity while still keeping the tabs visible? I have an activity in a tab, I use the menu to create a new activity to update the tab's activity displayed info, when I return from the menu activity I want the new information to be displayed in the tab's activity. I am using startActivityForResult() from the menu choice, but when I return and try to restart the activity...it wipes out the tabs above(I guess as expected, but I want to re-launch the refreshed activity within the tab).

Creating the tabs:

TabHost host = getTabHost();
Intent home_intent = new Intent(constants.HOME_ACTION,
null, this, homeTab.class);
Intent inbox_intent = new Intent(constants.INBOX_ACTION,
null, this, inboxTab.class);
Intent stats_intent = new Intent(constants.STATS_ACTION, null,
this, infoTab.class);

host.addTab(host.newTabSpec(constants.HOME_TAG)
.setIndicator(getText(R.string.home_label),
getResources().getDrawable(R.drawable.icon))
.setContent(home_intent));
host.addTab(host.newTabSpec(constants.INBOX_TAG)
.setIndicator(getText(R.string.inbox_label),
getResources().getDrawable(R.drawable.icon))
.setContent(inbox_intent));
host.addTab(host.newTabSpec(constants.STATS_TAG)
.setIndicator(getText(R.string.stats_label),
getResources().getDrawable(R.drawable.icon)).setContent(
stats_intent));

Return from the menu activity in the tab's activity(updating database info): code...

View 2 Replies View Related

Android :: Tabhost Working In Activity Class

Nov 17, 2010

I must be overlooking something because I am unable to get my TabHost to display in my Activity class.I am getting the dreaded force close when I try to run the app.It will work if I extend TabActivity, but I can't do that [details at the bottom] because once I move the code from my prototype project its going to be in a custom class that inherits from Activity.

View 2 Replies View Related

Android :: Showing Indeterminate Progress Bar In TabHost Activity

Jul 16, 2009

I know that the following code should show and hide a tiny circular progress bar with the following code in Android:

CODE:.............

The problem is that I am using a TabHost and I need to be able to do this from one of the "child" activities. Is there any way I can go about doing this?

View 2 Replies View Related

Android : Return A Result (startActivityForResult) From A TabHost Activity?

Mar 23, 2010

I have 3 classes in my example:
Class A, the main activity. Class A calls a startActivityForResult:

Intent intent = new Intent(this, ClassB.class);
startActivityForResult(intent, "STRING");

Class B, this class is a TabActivity:

Intent intent = new Intent(this, ClassC.class);
tabHost.addTab...

Class C, this class is a regular Activity:

Intent intent = this.getIntent();
intent.putExtra("SOMETHING", "EXTRAS");
this.setResult(RESULT_OK, intent);
finish();

onActivityResult is called in Class A, but the resultCode is RESULT_CANCELED instead of RESULT_OK and the returned intent is null. How do I return something from the Activity inside a TabHost?

I realize that the problem is that my Class C is actually running inside of Class B, and Class B is what is returning the RESULT_CANCELED back to Class A. I just don't know a work around yet.

View 4 Replies View Related

Android :: Access Progress Bar In Main-activity Containing Tabhost From One Of Tabs?

Nov 14, 2010

I am developing an android application where I have a main-activity that contains a progress bar and a tabhost. the tabhost has 3 tabs.How do I from a tab-activity access the progress bar in the main activity? I want to be able to start and stop the progress bar when things changes inside each tab ativity.

View 1 Replies View Related

Android :: OnSaveInstanceState Function In Main Activity Of TabHost-based Application

Aug 30, 2009

I've implemented an onSaveInstanceState function in the main activity of my TabHost-based application. I need to save the state of various objects I am keeping in memory that I have all marked as serializable, as well as some basic int and string values. I have stepped through my application and watched it call the onSaveInstanceState function and presumably save everything without any manner of exception or problem. The issue is that my onCreate function is being called with a null Bundle value every time after I start the application again. I'm really at a loss and unsure why it would call the save but not pass anything into the create.

View 1 Replies View Related

Android :: Content Of Activity Doesn't Appear / Why Is So?

Nov 23, 2010

I start a new activity when clicking on a button , but the content(ui components) of the new activity doesn't appear , why ? code...

View 1 Replies View Related

Android :: How To Switch Tab From Within Sub Activity

Feb 17, 2010

I'm currently working on an application, designed around a TabActivity.Tab1 has a button and I would like when the user click it, it switches to Tab2.

View 10 Replies View Related

Android :: How Does An Activity In A Tab Knows It Switch To Another

Sep 22, 2010

In android, I have a TabActivity with 2 tabs and each tab has it own activity (say ActivityA and ActivityB). When I am on ActivityA, and I click on ActivityB's tab, how does the ActivityA knows it is no longer the active Tab?

View 1 Replies View Related

Android :: Changing Content Of Activity Run Time

Jul 24, 2010

I created an activity by using a layout written in a XML file. I would like, in response to some events, to change the content of this activity. I would like to show a VideoView over the content. In response to some other event, I may want to go back to the first content. Would it be possible to switch the content of the activity this way without running another activity (I have another technical difficult in doing that)? I tried using setContentView( videoView), and then switching back with setContentView(T.layout.main), but it seems that, when going back to the main layout, all my buttons and text boxes are created again as they were new. Would it be possible to go back to the last state of all the controls?

View 4 Replies View Related

Android :: Call An Activity From Another One - Content.ActivityNotFoundException

Aug 8, 2010

I am getting this exception while I am trying to call an activity from another one.. .The complete exception is android.content.ActivityNotFoundException:Unable to find explicit activity class {com.x.y/com.x.y.class};

I am doing an intent.setClass("com.x.y","com.x.y.className") where className is the name of my activity class and com.x.y is the package it resides in.

My AndroidManifest.xml has the following content:

View 3 Replies View Related

Android :: Switch Tabs From Within An Activity Within A Tab

Mar 29, 2010

Currently I have a TabHost implemented with 3 tabs each containing a separate activity. My question is how do I switch between tabs from within one of the activities that is located inside the tab host. I've looked everywhere and have been unsuccessful in finding a real answer to this problem.

View 4 Replies View Related

Android :: How Do You Switch Activity Programatically?

Aug 28, 2010

It seems like every example I can find of switching between Activity's involves creating an Intent and passing in the context of a View via an OnClickListener associated with a button.But what if you just decide you need to switch Activity's? In my case, a Preference value is causing an Activity switch. How do you create an Intent that can cause an Activity switch without an associated OnClickListener?

View 4 Replies View Related

Android :: How To Switch From Activity To ListActivity?

Jul 24, 2010

This post probably shows my ignorance of Android coding, but here goes. I have a sample app I am developing which starts by extending Activity. I have a main.XML layout which works great. On a button click from the main layout I'd like to load a ListView. I think I understand how to use ListView and seed data into it. I have created a new layout which contains this ListView. I am confused, however, how I switch from a regular Activity to a ListActivity so I get the convenience methods like setListAdapter()? Should I be starting with a ListView, and then drawing the other view on top once the app starts by inflating the layout and using it? If not, how do I create a ListActivity object inside my app, and where should I create that? If you have a sample application or tutorial that shows how to do this, I would appreciate it.

View 2 Replies View Related

Android :: Way To Switch From Activity To ListActivity?

Jan 22, 2009

I have a main class derived from Activity, I need a ListActivity (displayed when the "menu" button is clicked). How can I proceed. I don't understand how I can switch from one to the other?

View 3 Replies View Related

Android :: Use Resource Id But Didnt Set Content View In Activity?

Aug 12, 2010

May I know is it possible I use the resource id but I didnt set the Content View in the activity?

For example: abc.xml have one TextView id = "R.id.Text". Can I use the use TextView name = (TextView)findViewById(R.id.Text); method in the activity which was setContentView(R.layout.def);?

View 2 Replies View Related

Android : How Can Query The Contacts Content Provider Outside An Activity

Oct 8, 2010

I'm trying to query the Contacts content provider outside an Activity. But managedQuery is a method of Activity. Is there any other class/method that I can use instead of managedQuery?

Here's my code:........................

View 1 Replies View Related

Android : Content Provider - Activity.startManagingCursor And Simple Dao

Jun 1, 2010

I am writing simple app that will read callLog content provider transform data and write it to my own table. my app will not show data directly from calllog content provider.

1. now one problem that I have is I cannot limit how much rows query will return (by calling activity.managedQuery) but I assume that Cursor delays access to the db and I can use moveToNext as many times as desired to get few rows from table and the call will be efficient. is that good thinking?? OR am I wrong here? I really dont want to query all rows from table. is there any other way to access calllog??

2. I dont want to implement my own content provider for my app. I will use rawQuery many times and group data so contentprovider's callbacks are not enough for me. more I want my dao to be private to my application so I think there is no need to bother with conentprovider. and If I got this right I also dont need to bother with activity.startManagingCursor as long I query data inside same method call (because I need to deactivate all intermediate Cursor objects anyway)

View 5 Replies View Related

Android :: Program Will Not Switch To Activity On My Phone

Oct 27, 2010

public class TestCamera extends Activity implements SurfaceHolder.Callback, View.OnClickListener {
Camera.PictureCallback mPictureCallback = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
// TODO Auto-generated method stub
picture = data } };
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_DPAD_CENTER)) {
mCamera.takePicture(null, null, mPictureCallback);
return true; }
return super.onKeyDown(keyCode, event); }
@Override
public void onClick(View view) {
switch(view.getId()) {
case R.id.camera:
picture_intent = new Intent(this, PictureViewer.class);
picture_intent.putExtra("picture", picture);
mCamera.startPreview();
startActivity(picture_intent); } }

In the emulator, the program behaves like it should. However, when I put this application on my phone (Nexus one), it doesn't switch to the new Activity when I touch the screen after I take a picture. If I touch the screen without taking a picture, it switches to the new activity. I can't figure out why my phone won't switch to the new Activity after taking a picture.

View 2 Replies View Related

Android :: Switch Between Activity With Rotation Animation

Nov 24, 2010

does anybody knows how to launch a new activity with rotation animation.That I would like to know if there is a way to do the same but instead of image, i will be activity (whith new layout).

View 1 Replies View Related

Android :: How Do I Switch To New Activity From A Custom Listview ?

Sep 1, 2010

I am in a situation like, i have custom list view. One button, with listitems. When i click the button, i need to switch the activity. But the calls, startActivityForResult(myIntent, 0); --> is a non static call. I couldnt initiate this function in onClickLIstener() for the button. Dont know how to proceed with this situation ? Can anyone help me out with this.? Code...

View 4 Replies View Related

Android :: Email App Switch Its 'main' Activity?

Dec 4, 2009

In android Email app, when I first launch it, it will shows me the 'account setup wizard' activity. But when I launch the Email app(after the account is set) again, it wont' show the 'account setup wizard' activity, it will show the 'Folder list activity ' instead.

How can it does the main activity switch (depends on the email account setup)?

View 2 Replies View Related

Android :: Pause Flash Content In WebView When Activity Isn't Visible?

Aug 7, 2010

I am experimenting with using a WebView to display Flash content inside my activity. Everything is working pretty well, but when the user hits the home key to put the activity into the background, the Flash content keeps running (sound keeps playing, etc)

I have noticed that both the stock Android browser and Dolphin Browser seem to avoid this problem, and properly pause the Flash content when the browsing activity is put into the background.

Ideally I would like a solution that kills the WebView completely if the activity is finishing, but pauses it otherwise (basically copying the default behavior of the browser)

Here is a simple test I put together that loads a game on Kongregate which has some background music:

CODE:..............

I took a look at the latest source for the stock browser, and it seems to be doing something similar (calling pauseTimers/resumeTimers), although I fear the code I have been looking at is out of date, because it is calling functions that don't seem to exist anymore.

I did verify that the call to pauseTimers is working by testing with a simple JavaScript setInterval which updates a counter. Is there something else obvious that I should be trying in regard to Window or View management?

The documentation for the mobile Flash player says:


Flash Player will also automatically pause SWF playback it is not in view or the foreground application, for example when a call is received or alarm goes off, to reduce CPU utilization, battery usage and memory usage.


This seems to be working perfectly in both the stock browser and Dolphin Browser, but not in my app. Any ideas/solutions would be greatly appreciated!

Update: Here is the function we ended up adding to our activity to get this to work. We call it with "onPause" in the activity's onPause function and "onResume" in the activity's onResume function:

CODE:....................

View 2 Replies View Related

Android : WebView - Not Able To Go Back To My Activity Screen Once The Content Is Displayed

Apr 9, 2009

Step 1: I am subclassing WebView and rendering html content properly. The intial content is very small with a div and image /link This is displayed in a LInear Layout along with a TextView and ListView. That is my first screen/activity of the application.

Step 2: When I click on a link on this webview, it goes through the webViewclient and expands to full screen to fit the content of the requested page.

After Step 2, I am not able to go back to my activity screen once the content is displayed. When I click on the back button to getback to my activity screen close my activity and goes to the phone's applications desktop. (i.e goes out of my application).

Step 3: In order to fix this issue, I stopped setting my own subclasssed WebViewClient. After doing this, the it seems to render the clicked page in a webView as subactivity. Now When I click on backbutton, it goes back to the activity screen. But, the issue now is, I am not catch event when a link is clicked. How can I catch click events in this case.

View 2 Replies View Related

Android :: Simple Activity Switch Not Working - No Errors

Feb 19, 2010

I have a basic calculator app I'm making. Two activities, the main one and ResultView.

I've made it where I click a button on activity A to go to activity B. The log says activity B is started and "displayed" successfully, the title for the new activity loads, but the body does NOT show. I added a simple Text view with static text.. see the result.xml at the bottom. I also tried inserting information programmatically, but that didn't do.

When I debug the program, I tried putting breakpoints as the activity is called with startActivity() as well as on the first line of the onCreate method within the ResultView class (my activity "B") but the program never hits the second breakpoint. In fact, it looks as if Looper.class is called in the end.

This bit of code is placed in the button handler on acitivity A:

CODE:........

The activity is in the manifest, within the "application" tag:

CODE:....................

If more info is needed, let me know...in short, "HELLO WORLD" does not display at all.

View 2 Replies View Related

Android :: Activity To Show Directory Explorer To Browse Content Of Sdcard

Sep 20, 2010

In android, is there an activity show a directory explorer to browse content of sdcard?Like a File explorer in Java, it can show the content of current directory and I can move up to its parent by clicking '..' and move down to a child directory by clicking the name of the child directory?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved