Create New Activity Or Update View Of Existing Activity?

Dec 24, 2012

I am working on developing an app and I am not sure when should I use a new activity and when should I update the existing view.

For example, lets say I have a view that shows a multiple choice question.Now, when the user selects his choices and clicks on say "Evaluate", I want to show the same question view but along with the right answers and explanations for each option. So does that mean, I should send an Intent upon a click on Evaluate or I should just update the view (i am not sure how)?

If I send an intent and show a new screen, how can the user go back to the next question without displaying the answers? If I don't create an new activity, how can I update the existing view that is already displayed?

Create new Activity or update view of existing activity?

Android :: Can Update A List View In One Activity While Im In Another Activity

Oct 4, 2010

I currently have a tab layout with 2 tabs, one tab with a list view and one with the option make strings so I can add them in the list view. Both tabs have their own activity because this made the code much more structured, and I dont have to repeat my self later.

Lets say im in the tab that offer me to create an string, and i press the update list button, how do I update the list view without startActivity()? If i use startActivity(), it starts, and instead of displaying the list in the list view tab, it takes full screen, which defies the purpose of the tab view. In other words, the startActivity() steals the focus from the tab view of the list, and sends it fulscreen.

I want to update the activity in my list view tab, without starting a new activity that goes to fullscreen, and doesnt update the one in the tab.

View 2 Replies View Related

Android :: Update Intent Of An Existing Activity While Calling StartActivity

Sep 13, 2010

I am having two activities, say activity A and B. Activity A is an ListActivity, and when the items in the list is selected, it will call startActivity() to bring up B. The problem here is that when I am in B and click the home key, and then go to the application launcher to resume my application, A will be brought up again. This time when I click a different item in A, it will bring up B with the old data of the previously selected item before the home key was clicked.

After examinzing the code, I found that the startActivity does not update the intent of B. I found a post here about the similar question, and the answer was to overwrite the onNewIntent. However, I found that it doesn't work, because this method never get called when the second time I call startActivity. I am sure that this is the same instance, because I've printed out the instance number. Is there any other ways to update the intent of the activity? Or I need some other settings to make the onNewIntent get called? I didn't set any flags or launch modes, so everything is default.

View 1 Replies View Related

Android :: Handle Existing Instance Root Activity Launching Root Activity From Intent Filter

Apr 3, 2010

I'm having difficulties handling multiple instances of my root (main) activity for my application. My app in question has an intent filter in place to launch my application when opening an email attatchment from the "Email" app. My problem is if I launch my application first through the the android applications screen and then launch my application via opening the Email attachment it creates two instances of my root activity. steps: Launch root activity A, press home Open email attachment, intent filter triggers launches root activity A Is it possible when opening the Email attachment that when the OS tries to launch my application it detects there is already an instance of it running and use that or remove/clear that instance?

View 1 Replies View Related

Android :: Create Expandablelist View Activity With Checkboxes?

Feb 11, 2010

now i dont know which event to implement to handle checkboxes in list when i click on checkbox it expands the list.... how to distinguish list click with checkbox placed in expandable list? or kindly refer me to tutorial same as expandablelist view with checkboxes.

View 1 Replies View Related

Android : TabWidget Activity Handling - Does It Create New Activity EveryTime?

Apr 27, 2010

When a TabWidget is using intents to designate the target Activity for each tab, is there any special handling of those Activities on the Activity Stack outside of the default operation? For Instance, if my app has tabs A, B, and C, and I click them in this order--A, B, A, C, A, B--how will the Activity stack change? My understanding of the default operation, if startActivity() is called each time on the intent, would have the Stack keep loading up new instances of the activities: A, AB, ABA, ABAC, ABACA, ABACAB It's hard to believe that's how it works though... Seems like it would be a waste of resources and could be endless. Can anyone tell me how this will actually work?

View 2 Replies View Related

Android :: TabActivity Crash When Create Tabbed View In Widget Configure Activity

Dec 4, 2009

I'm trying to create a tabbed view in my widget configure activity. I'm using a tab activity as my activity type and I have the following code..................

View 2 Replies View Related

Android :: How To Get Activity View Inside That Activity?

Nov 11, 2010

I want to show my next activity withing my previous activity layout "LinearLyout". But it is not working. Can any one help? I put my last activity layout reference to a global class in an static variable. My code...

View 3 Replies View Related

Android :: Android's Listview - Update View Within Of Cells Just After Invalidating Activity's View

May 15, 2010

I have ListViewActivity
public class SelectActivity extends ListActivity {
protected void onCreate(Bundle savedInstanceState) {
SimpleAdapter adapter = new SimpleAdapter(
new String[] { KEY_VALUE },
new int[] {});
// ...

after setListAdapter() calls I would like to execute the following code:

((TextView) getListView().getChildAt(0).findViewById(, 0, R.drawable.ticked, 0); but getListView().getChildAt(xxx) returns null and I catch NullPointerException. Where should I put mentioned above code-snippet?

View 1 Replies View Related

Android :: Create A New Activity To View Text Written In Text Box?

Aug 31, 2010

Do I need to create a new activity to view text written in a text box?

For example,

I want to see - "Hello"+ text written in a text box.

View 2 Replies View Related

Android :: Update Activity Textview After Changes From Another Activity

Nov 19, 2010

I have an Android activity that, onCreate(), will query a database and display the query results in textviews on the UI.The problem that I am having is at some point, users can open another activity and update the database. When they go back to the original activity, I would like for the text views to update with the new database information (so, I will re query the database and display the info).Another thing that I am willing to do is to take the new input from the user (in the new activity) and directly update the textview in the existing activity (without having the existing activity re-query the database). But I'm not sure how to do something like that either.Can someone please inform me on the best way to go about doing this? The only solution that I have found so far has to do with broadcast receivers, but I'm not sure if that is best suited for what I have to do.

View 2 Replies View Related

Android :: How To Bring Existing Activity To Front Via Notification

Jul 28, 2010

I have one Android application, when it runs a service, I want to show the notification on the status bar. Then the user could navigate to other application by pressing HOME key. However when I try to bring the previous running application back to Front via notification icon, there is some problem with the existing activity. Even I declare it as "Single Top" mode (I want to run the existing activity since there is an associated service running) , somehow that activity's OnDestroy has been called before OnResume. Here is my code of creating the notification object.


View 1 Replies View Related

Android :: Can I Create An Activity For A Particular Task?

Mar 17, 2010

Here's my use case: The app starts at a login screen. You enter your credentials and hit the "Login" button. Then a progress dialog appears and you wait for some stuff to download. Once the stuff has downloaded, you are taken to a new activity. Exactly which activity you are taken to depends on the server response.
Here's my problem: If you go HOME during this login/download process, at some point in the near future your download will complete and will invoke startActivity(). So then the new activity will be pushed to the foreground, rudely interrupting the user. I can't start the activity before I start the download, because, as I mentioned earlier, the activity I start depends on the result of the download.

I would obviously not like to interrupt the user like this. One way to solve this is to refrain from calling startActivity() until the user returns to the app. I can do this by keeping track of the LoginActivity's onStop() and onRestart(). But I'm wondering, is there any way to create the activity while it is in the background? That way the user returns to the app and he is ready to go. otherwise he would have to wait for the new activity to be created (which could take some time because the new activity also has to download and display some data). Update: Guess what? I LIED! I could have sworn that starting this activity was causing it to come to the foreground, but I went back to test it again and the problem has magically disappeared. I tested in both 1.6 and 2.0.1 and both OSes were smart enough not to bring a backgrounded task to the front.

View 2 Replies View Related

Android :: Create Project And Activity Name

Nov 9, 2009

Once upon a time (Android 1.5 and earlier), when you would create a new project using the "android create project" command, it worked well -- you had an app that could immediately be compiled and installed.

Now, though, when you run that command, a number of places need fixing up, where ACTIVITY_NAME shows up instead of the activity name specified...depending on the API level you target.

For example:


leaves ACTIVITY_NAME in:


If I change the target to 1, 3, or 4, it works as expected. If I have the target as 2 or 5, it gives me the ACTIVITY_NAME.

So, I'm curious to know if:

a. This is a bug, or

b. I'm missing something (despite this example coming straight from the docs), or

c. I've lost my marbles

View 2 Replies View Related

Android :: How To Create A New Activity In Eclipse?

Sep 11, 2010

I've gone through a few guides and tutorials, and they're quite clear on how to start an activity (with intent). However, how do I create a new activity in Eclipse? I can probably do this by hand by then I have to modify the R file which is auto-generated. I can create a new XML layout.

View 3 Replies View Related

Android :: Create A ExpandableListView In One Activity?

Nov 2, 2010

I'm trying to create a ExpandableListView in one activity. I've looked in apis demos, and I've created ExpandableListView. The problem is, that I need to have this ExpandableListView in activity that is already created, and not in a new one.

I've used this code:


View 3 Replies View Related

Android :: Create An Activity With 2 Status Bar?

Sep 16, 2010

Can i create an activity with 2 status bar?

Can i put the status bar at the bottom of Activity?

View 1 Replies View Related

Android : Can I Create Tabs From Activity?

May 18, 2010

Is it necessary to use TabActivity for displaying Tabs. I want to display tabs from Activity.

View 7 Replies View Related

Android :: How To Create A Transparent Activity Programmatically?

Jul 28, 2010

I want to launch an Activity with a webView as its content from current Activity. This new activity needs to be transparent and webview should be in the center. I looked around the web but only solutions I found were using style xmls. I want to do it using pure code i.e. no xml declarations. if anybody has come across this then please shed some light.

View 1 Replies View Related

Android :: Want To Create A ListView Activity With An Image In Every Row

May 5, 2010

I have been trying to create a ListView Activity with an ImageView in every row. I've used this tutorial: The issue is that there are always some dividers missing whenever I run the example. The dividers are disappearing/appearing and flickering as i scroll the list (tested in emulator and HTC Tattoo). Strange is that the same example downloaded from the market (API Demos app) behaves correctly. Here is a screenshot of how it looks:

View 5 Replies View Related

Android :: Whether To Start Stopped Activity Or Create New One?

Feb 18, 2010

Long story short, I have a LaunchActivity which is always called by LAUNCHER (i.e. the home screen). It then starts LoginActivity and then closes itself.This is the flow:
User launches app
LaunchActivity starts, starts
LoginActivity and then calls
finish() on itself (At this point
LoginActivity is the only Activity
on the stack)
User press "Home" button, stopping
User launches the app again When the app is launched for the 2nd time, two things can happen:
LaunchActivity starts, finishes
itself and then STARTS LoginActivity
LaunchActivity starts, finishes
itself and then CREATES
LoginActivity, so there are now two
LoginActivitys on the stack.
(2) seems to happen when I restart Eclipse and the simulator (yeah I know, black magic). Some extra info: I'm not using any start flags and my manifest doesn't have any launchModes defined.

View 2 Replies View Related

Android :: Create Support Application To Activity?

Feb 22, 2009

In case there is anybody out there who would like to create a support- application to an activity that is already used by everybody on the Internet, the moment has come! I'm particularly interested in developers with deep knowledge of Linux services and/or the Android GUI. Note: this is not yet another password vault or similar, this is about *eventually getting rid* of passwords!

View 2 Replies View Related

Android :: How To Create Multiple Instances Of An Activity

Feb 19, 2010

I want to create multiple instances of an activity in the same process. Should I use FLAG_ACTIVITY_NEW_TASK flag like the code below?


This code is executed in class A to create another instance of activity A.

This question, will this code create another task? As I understand is a process can only have one task. Does it mean the two activities will exist in different tasks? That's what I want. I want the two activities to be in the same process.

View 1 Replies View Related

Android :: Create A Class Which Not Extended Activity?

Sep 23, 2010

How to create a class which not extended Activity & how can i use it class?

View 1 Replies View Related

Android :: Create Transparent Activity In Droid?

Feb 1, 2010

I want to create transparent create on another activity.

How can I achieve this?

View 3 Replies View Related

Android : When To Use Layouts / Create New Activity Classes?

Mar 3, 2010

I'm writing a game for Android. My GUI has the following basic screens (i.e. the information and interactions required on each of these would take up the whole display):

Main menu (let you start a new game, enter settings, see high scores, see about screen)
Game screen i.e. where the actual game is played.
Settings screen.
High scores screen.
About screen (i.e. credits and a back button)
Game over screen (arrived at when the game ends)
Pause screen (pauses game and can access settings)

The following are some example transitions the user might make between these screens:

1->2->7->2->6 (starts new game, pauses game, returns to game, finishes game)
1->5->1->4->1 (views about screen, goes back to main, views score screen, goes back to main)

I'm really confused about when to have just one activity that switches layouts and when to create new activity classes. For example, when my game loads, I have a "main" activity that loads the main menu layout. When you click the settings button, I launch a "settings" activity (which uses android's standard settings GUI). For the moment, when you start a game, I switch the layout of "main" to the game screen layout (which just contains one big surface view). I'm not really sure what the best way to integrate the game over screen, high score screen, about screen etc.

Creating a new activity for each seems really heavy weight to me. There's quite a lot of boiler plate code involved for each activity. Plus, communication between activities seems like a pain as you have to use bundles. Using just one activity means I can just share object fields directly. It seems that using layouts for the above would be more compact. Can anyone give me some recommendations?

View 1 Replies View Related

Android : Can't Create Multiple ListViews In One Activity

Mar 23, 2009

I want to have multiple listviews in my activity. Every listview will have a different adapter and every item in the listview must be clickable (other actions for every listview).

So my problem now is that I can't create multiple clickable listviews. I have one listview like this <ListView android:id="@android:id/ list".. and the other listview looks like this <ListView android:id="@+id/ flightList"

The first listview looks like this in my activity hotelList = (ListView)findViewById(;

the second: listView = (ListView) findViewById(;

I can click on the first list and it does what it has to do, but i cant do anything with the second list.. probably because it hasn't the android:id/list declaration. does someone knows how I can solve this problem or other suggestions how I can get multiple lists in 1 activity.

View 25 Replies View Related

Android : How To Create Multiple Instances Of An Activity?

Jul 1, 2010

I was wondering is it possible to create multiple instances of a single Activity in Android?

I currently start my own inCall screen for a Voip Test by using the following code...

This allows me to start the Activity fine. However when I call it for a second it just returns to the Activity already created rather than creating a new Activity and placing it on the stack.

I would like to be able to create the activity multiple times so that I have two or 3 Activities on the stack and the user can switch between them, using Home, Back buttons etc... Is this possible and if so what am I doing wrong?

View 1 Replies View Related

Android :: Create A Photo Sharing Activity?

Aug 31, 2010

How can I create a custom activity that can be chosen by the user via the share option when viewing the photo gallery? I have options like "Share with Facebook, Twitter, FlickR" etc. But I want to add my own option in there.

i.e. Go to "Photos", then click the "Share" button. You will be presented with a bunch of share providers. What do I need to do to get my activity in there?

View 2 Replies View Related

Android :: How To Create Icon On Home Screen Through Activity

Oct 7, 2009

I would like to have icon created on home screen through an activity . All the icons of my activities are on main menu, once i click it my activity will be launched instead i need an icon on home screen which when clicked activity should be launched.

View 4 Replies View Related

Copyrights 2005-15, All rights reserved