Android :: Conditional Restart On Activity OnConfigurationChanged

Mar 19, 2010

I want to make an activity that allows orientation changes on some condition, but not otherwise. More exactly I want to prevent restarting the activity when a background thread is busy.

I have put the configChanges attribute on the activity manifest, and onConfigurationChanged is called when the orientation changes. However I want to allow the app to change the orientation when allowed.

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

Android :: Conditional restart on Activity onConfigurationChanged


Android :: Force Activity In Landscape Mode Without Activity Restart

Aug 21, 2009

I have a problem to start/create Activity in landscape mode. My Activity need to start in landscape mode and be used in landscape mode by users. So far, I used setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) to force screen orientation of my Activity to landscape mode in onCreate() method.

In addition to this screen mode requirement, my application need to start another background thread in onResume() method, and this thread takes some seconds in order to finish an initialization process, and it is not desirable to to stop/restart this thread's service during the initialization process.

However setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) forces my Activity restart in a very little while (means onCreate->onResume->onPause->onStop are executed twice at the first place). As a result, my background thread be stopped/restarted during the initialization process, and this makes me a mess at this moment.

View 3 Replies View Related

Android :: Best Way To Restart Activity?

Aug 17, 2010

I'm building a game which works as some type of a quiz. I ask user the question and when he submits the answer(click or touch correct answer) I need to refresh the page with some other question.

How should i implement this? How to wait for users answer and continue when onClick or OnTouch listener finishes?
Should i use Handler class, intents or something else?

I want next scenario:
On the screen I have a question and 3-4 clickable ImageButtons. I'm building some of the layout dinamically from custom showQA() function. User choose the answer and if he clicked the correct answer i should start some type of animation on the screen. I've done that from the onClickListener. Now, i need to build layout again(show new question and answers) from the showQA() function which must be called after that animation showed to the user. How can i know when the onClickListener() finished its work?

View 3 Replies View Related

Android : Manually Restart An Activity?

Sep 9, 2009

Is there a way to restart an activity? The reason is that need to change the theme dynamically, and the activity needs to be restarted and redraw itself after the change.

View 5 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 :: Activity Restart Crash After OS Kills It

Mar 8, 2010

Activity SplashScreen is the launching activity for my app. It sends a request to my server and gets back a user data it then uses to populate a user object which is a static object. Once it has that it calls the MyMapView activity and finishes itself. A force close occurs when I hit the home button and then open up enough other apps so that Android kills MyMapView to get more resources. Now when I open my app again it tries to start MyMapView and bypasses SplashScreen. There is no user object so I get null pointer exceptions. I have tried to Override the onSaveInstanceState and OnRestoreInstanceState but it seems that those are not available when Android kills the activity. I also tried android:finishOnTaskLaunch with the SplashScreen (maybe this should be put on MyMapView but the article I read said different) and that seems to have no effect. What I would like is for the activity to not restart after Android has killed it. What can I do about this?

View 5 Replies View Related

Android :: Force Application To Restart On First Activity

Mar 18, 2010

For an unknown reason, I can't get my application leaving properly so that when I push the home button and the app icon again I resume where I was in the app....But I would like to force the application to restart at the first activity...I suppose this has something to do with onDestroy() or maybe onPause() but I don't know what to do..

View 4 Replies View Related

Android :: Using FLAG_ACTIVITY_CLEAR_TOP - But Don't Restart Target Activity?

Nov 21, 2009

I'd like to use FLAG_ACTIVITY_CLEAR_TOP to launch an activity in my app. It has one feature I don't want though - it restarts the target intent, instead of just resuming it. Example history stack, with activity D making the call to B with that flag:

A B C D

new stack

A B

But 'B' gets relaunched, its onCreate() method is called. Since B is already in the history stack, is there a way I can use this flag, but have it *not* recreate B, just onResume() it again? The reordering flags are kind of what I need too, but they won't pop C and D, just reshuffle the stack so B comes to the top, but I want C and D to go away.

View 5 Replies View Related

Android :: Changes To Library Doesn't Restart The Activity

Nov 5, 2010

I'm developing an application that uses a library project to store much of the functionality and content. When I edit the code and/or content in the library and then run the app, it doesn't properly restart the activity with the changes, giving the warning:

Warning: Activity not started, its current task has been brought to the front

I understand that this warning comes from the SK not thinking that there were any changes to the app, but there were (to the library, not to the app itself).

The only way that I've found to force the app to recompile with the library changes is to do Project->Clean. While this is effective, it's a bit annoying to have to do this every time a make a change. Does anyone know of a way to force the SDK to recognize that a library change should result in reloading the application?

View 2 Replies View Related

Android :: Keep Task's Activity Stack After Restart From Home

Jan 13, 2010

My application has two activities, that I start in this order: HOME > A > B Now I press HOME and launch "A" again. I would like to see activity "B" on a top of "A", but instead I get "A" - so the activity stack is cleared. Manifest: <activity android:name=".activity.A" android:label="A" android:always Retain Task State = "true">What should I do?

View 2 Replies View Related

Android :: How To Bring Stop Activity To Foreground (restart) By Itself ?

Sep 22, 2010

How to bring stop activity to foreground (restart) by itself?i use Broadreceiver and intent to restart my activity.but always start two activity (include original activity)how to restart my original activity?

View 4 Replies View Related

Android :: Broadcast Receiver / Service Will Only Restart Activity Once

Mar 17, 2010

I have a single Activity application, within it I have a service which creates an AlarmManager and sends a broadcast to a broadcast Receiver.If the activity which starts the services dies, (ie. divide by zero), the broadcast receiver stops the old service which created the AlarmManager.It works the first time. The second time, it does not.It seems like the AlarmManager is still active but the broadcast receiver is no longer receiving. It works great once!

View 2 Replies View Related

Android :: How Can Display Saved Data When Restart Activity

Oct 6, 2010

In my Project I want to play audio files in mediaplayer and displays progressbar. If I exit the application then also player have to play audio file. If I restart The Activity
I have to display progress bar with last activity progress.

Here I tried using onSaveInstanceState() method. But I cant display progress bar with last progress. when I exit the activity player is playing but when I restart activity it stopped and displayed new view without any progress and saved data.

View 1 Replies View Related

Android :: Can't I Override OnConfigurationChanged / Cause Of That?

Jan 9, 2010

I'm trying to override the method onConfigurationChanged and I get the error:

The method onConfigurationChanged(Configuration) of type BaseActivity must override or implement a supertype method

Here is my BaseActivity.java code...

A lot of post out here in the Internet is saying that I can do that.

View 3 Replies View Related

Android :: Avoid Activity Restart At Keyboard Open Or Close?

Jul 28, 2009

I have fixed the activity screen orientation to portrait on AndroidManifest.xml file. When I open or close the keyboard the activity gets restarted. How to avoid this restart?

View 4 Replies View Related

Android : Way To Get NEW Width / Height Of Root Layout In OnConfigurationChanged?

Mar 26, 2010

One of our views has a ScrollView as its root layout. When the device is rotated and onConfigurationChanged() is called, we'd like to be able to get the ScrollView's new width/height. Our code looks like this...

View 1 Replies View Related

Android :: Android Activity With Splash Screen Restart And The Back Button

Nov 8, 2010

I have an Android app with a splash screen.

This splash screen pre-loads data and when finished starts the application's main activity and finishes (through a finish() call).

This works quite well as long as the application is not totally killed. So, I can usually switch back and forth between different tasks as usual: when I leave the app from a sub activity and return soon after I will be presented with this sub activity.

Now, when I leave this sub activity and do some other stuff for a while inevitably this application process is killed by the OS.

No problem so far. Now I would expect Android, being unaware of my preloading (if the data was not preloaded it would just take longer or not display some fonts, but Android cannot be aware of the fact that I am doing preloading somewhere), to restore the sub activity from a Bundle. However the splash screen activity is started.

So, I say, that's fine then... the splash screen activity is after all the launcher / main activity. Now, the actual mystery I have is as follows.

When I press the back-button from this newly loaded splash screen I will be presented with the sub activity I left the application from before it got killed. I really don't understand this. Apparently Android DID save the sub activity's state (and its history stack) to be reloaded but instead of reloading it chose to start the splash screen instead, with this sub activity (I left the task earlier before it got killed) one step back on the activity stack.

Why does this happen?

When the process is not killed I can switch back to where I left off. When it's killed I cannot (yet still have the whole earlier history of that app restored). I know that Android has to load state etc. in the latter case, but that shouldn't be a problem and is performed automatically by default (according to the docs).

View 1 Replies View Related

Android :: How To Restart Scheduled Jobs No Phone Restart

May 15, 2009

I am developing a ToDo reminder type of app for android. on creation of a new reminder an alarm and vibrator scheduler is created with a toast. This works on intents and broadcasts and is pretty straight forward stuff with putextras using the reminder id from the db. My problem is, if some one restart the phone, i guess all the scheduled alarm and vibrator tasks for the reminder will be killed. Once the phone restart again how to recreate the scheduler tasks.

View 2 Replies View Related

Android :: Android Back Button Does Not Restart Activity

May 8, 2010

My app intiates an activity. On the click of a button, the app opens up the browser with a webpage. When I hit the back button, it comes back to my initial activity screen, but does not resume or restart the activity.

When I put all the layout code and activity code in onResume instead of onCreate, the activity gets restarted.

My question is whether this is the right way to go about it? Can I use onResume to draw my layout and initiate the activity, or is this poor design? When the browser fires up, does the initial activity forget its layout?

View 1 Replies View Related

Android :: ExpandableListView - Is Conditional Expansion Possible

Aug 12, 2010

I have an ExpandableListView bound to a SQLite database. To simplify things, lets assume the database contains two columns: title and body. In the ExpandableListView, there is a group for each title, and a childfor each corresponding body.

Now to make things more interesting, some of the rows in the SQLite database do not have a body (that is... they only have a title). As you can see, if there is no body, then there is no reason to expand the group... because the child will be empty (i.e. String body == "").

I'm searching for a way to catch a situation like this, and skip the group's expansion. I don't want a blank child to be expanded. To put it in psuedo code, I want something like this:

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

View 1 Replies View Related

Android :: Conditional Compilation In JAVA?

Mar 30, 2010

How to do conditional compilation in JAVA.

something like in C, C++ :

#ifdef TRUE_CONDITION

#else

#endif

View 14 Replies View Related

Android :: Conditional Muting On Music Application's

Feb 2, 2009

I would like to mute my application's music when the user is listening to mp3 with the OS music player. I'm using 2 channels in my app so I can't use AudioManager.isMusicActive().

View 2 Replies View Related

HTC Droid Eris :: When Aps Restart My Phone It Takes About 15 To 20 Seconds To Restart

Apr 20, 2010

I have noticed that when aps restart my phone, it takes about 15 to 20 seconds to restart When i Power down, it takes MINUTES!Does anyone know of simple restart app I could use to avoid this? If not, anyone know someone who could make one?

View 3 Replies View Related

HTC EVO 4G :: Sprint Conditional Call Forwarding

May 25, 2010

Getting my EVO tomorrow, bought from Google I/O attendee. Not 100% sure I am going to ditch my Sprint Touch Pro 2. I think I will activate the EVO using the Google I/O free month of service and use conditional forwarding on my Sprint TP2 subscribed number and direct it to the EVO. That way I can keep the TP2 off, or with the phone radio off at least, and get calls routed to the EVO for free with no/very little delay. That way I can test the EVO without switching service from my TP2, and not give out the temp EVO phone number, and not rack up charges on my existing subscription with Sprint.

To enable conditional call forwarding:
*28 + number + send

To disable conditional call forwarding:
*38 + send

I think this will work without charging me airtime to my TP2 account, as opposed to standard call forwarding (*72) which is quite costly.

View 13 Replies View Related

HTC Hero :: Conditional Jerky Video Playback

Aug 14, 2009

The bundled sample video (Hero_Sample_Video.mp4) is playing nice and smooth. However, when I try to encode a file in the same format with ffmpeg, I get jerky playback. Videos seem to play slower, then quicker, then slower, etc. I'm encoding with the same settings as the sample clip, i.e. H.264, 480x320 and 48 kHz Stereo AAC audio. I have tried low and high bitrates, different quantizers and even two different containers: MP4 and M4V. I fail to obtain smooth playback even with the H.264 settings from https://help.ubuntu.com/community/AndroidVideoEncoding aimed at Android phones. Smooth video playback is obviously possible on this phone, since the 30 FPS full screen sample clip plays back without a hitch, so what are the secret flags I need to pass ffmpeg to attain this holy grail?

View 4 Replies View Related

Sprint HTC Hero :: Sprint Call Forwarding - Conditional Vs Unconditional

Nov 19, 2009

Sprint has reportedly stopped charging $0.20 per min for call forwarding (Conditional only). See here:
Google Voice & Sprint... 11/08/09 Inside Sprint Now. I've read tons of forums, discussions, web sites, and there's a lot of conflicting information and some Sprint reps are getting confused on this, it's new.

However, here's my general understanding:.................

View 3 Replies View Related

Android :: Looking For An App To Restart My Phone

Jan 22, 2010

I've been having some reception issues that seem be cleared up when i restart the handset. What I'd love is to be able to schedule a daily restart around 4am to prevent any problems from the phone running too long. Does anyone know of an app that could do this for me?

View 9 Replies View Related

Android :: Possible To Restart Phone With SDK Or NDK?

May 11, 2010

Is it possible to programmatically restart the phone from a application (service) running on top of the Dalvik VM?If the SDK does not provide this functionality, then how about using the NDK and calling some functions provided by the kernel? I know this option is not preferred (not stable enough libs), but if it's the only option, I'll have to consider that as well.

View 2 Replies View Related

Android : Restart A Webview With Different URL?

Nov 9, 2010

I want to restart my webview with different URL, here i have taken one button onclick i m changing URL now how to reload this activityin short how to restart the same activity..

View 1 Replies View Related

Android :: How Do I Restart Service Automatically?

Apr 29, 2009

How do I restart my service automatically when my service gets killed or crashes, until and unless I myself de register the service.

View 2 Replies View Related







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