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
Jan 27, 2010
I am using android vnc viewer on my G1. But for some reason, that application always in landscape mode despite my G1 is in portrait mode. Since android vnc viewer is open source, I would like know how is it possible hard code an activity to be 'landscape'. I would like to change it to respect the phone orientation.
View 3 Replies
View Related
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
Aug 6, 2010
I have an application which is in portrait mode. However, I want to run a particular activity in landscape mode. I have tried the following with no success.
View 2 Replies
View Related
Nov 5, 2010
The default behavior from my observation is if current activity force closes Android tries to go to previous activity on stack How can I control this behavior? I want force close to close all activities
View 2 Replies
View Related
Jan 27, 2010
How can I force my android activity to always display in landscape mode? For example, in android vnc viewer, it always display in landscape mode regardless of my phone orientation (see attached).
View 7 Replies
View Related
May 23, 2010
As many of you know the Home screen does not change when going into landscape. In Froyo there is landscape for the home screen when in Car dock mode. Will there be a way to force car dock mode when going into landscape.? Maybe an app that can solve this.
View 4 Replies
View Related
May 13, 2012
I bougt a tablet and I want to use Zplayer but Is there a way to force the app to be in landscape mode?
I have a Transformer Pad and I belive theres no root if theres a whay that require root...
View 6 Replies
View Related
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
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
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
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
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
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
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:...................
View 1 Replies
View Related
Jul 21, 2010
So my Aria is less than 24 hours old and twice now when texting in landscape mode a Force Close pops up and I can only type in portrait mode. I am using HTC keyboard and have not loaded any other keyboard. is this happening to anyone else?
View 20 Replies
View Related
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
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
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
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
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
Mar 10, 2010
I have written code to display images in sequence. when click on next button it shows next image.and so on. i m using android 1.5 and save landscape images with same name(as portrait images have) in drawable-land folder. when i rotate the device it takes all landscape image from drawable- land folder. but the problem is ,it again start showing images from the beginning. how to solve this problem.
View 2 Replies
View Related
Jun 3, 2010
I have an Android application with a main activity that is the tabhost. I'm adding multiple tabs to the tabhost with an intent to several activities.
My problem is that these activities are not created (onCreate is not called) until I click on the tab. This is a problem because I need to register broadcastreceivers: there may be broadcasts that are sent -before- a particular tab is opened.
I tried to work around this by:
Setting my receivers as static and registering from somewhere else. This is not possible because I need to call into methods.
Calling into tabHost.setCurrentTabByTag(the_tag) and then switching back to my root tab. This only works sometimes and this is a very ugly solution imo.
Not using activities but just using views instead. Also not a very elegant solution because it turns my tabHost activity into one huge master class doing all kinds of unrelated things.
View 1 Replies
View Related
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
May 20, 2010
My application contains 2 activities A and B. B is opened with startActivity(intent) in A, when B is closed with finish(), I found the method finalize() of B is not called.
My question is: How to force Activity to call finalize() when it is closed with finish()?
View 5 Replies
View Related
Sep 29, 2010
I'm writing a widget with a configuration activity which calls the following method when its OK button is clicked:
CODE:..............
This is almost verbatim from the documentation. widget_id holds the widget ID that was dug up during the activity's onCreate().
When I place an instance of the widget on the home screen, I've verified that I get the expected sequence of events:
onReceive() gets an ACTION_APPWIDGET_ENABLED if it's the first one.
onUpdate() gets called (in which I detect that the widget isn't configured and draw something as a default action).
The configuration activity appears.
When I press OK, the ok() method above gets called.
The method gets all the way through to the finish() and the configuration activity goes away, but there's no call to onUpdate() or onReceive() after this point. (The widget itself has no updatePeriodMillis.) I end up with a widget on the screen that has the results of my default action but never gets updated.
If I set the widget up without a configuration activity, it gets updated when created and everything works as expected (just without the configured bits).
View 1 Replies
View Related
Jul 19, 2009
I have an application, where I need to change the language through a settings menu. Now this part works perfectly, but it doesn't change the language for activities that have gone through onCreate.
I got a TabHost, and 2 tabs in it, from the tabs you can get to settings.
Refreshing the TabHost isn't an issue, as it's fairly small, however both the 2 tabs are quite large views, and having a function to manually update all the strings seem unnecessarily difficult. Is there any way to force the activity to recreate itself and trigger a new onCreate?
I tried having a static function in the tabhost that clears all tabs and recreates them, this refreshes the tab titles, but not the content in the tabs.
View 5 Replies
View Related
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
Jun 29, 2010
My app keeps force closing before it starts, eclipse returns no errors in my code and my xml is good.
package com.mhe.test.scan;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class main extends Activity {
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button myScanButton = (Button) findViewById(R.id.myScanButton); myScanButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(intent, 0);
} } );
} EditText totalbox = (EditText) findViewById(R.id.totalbox);
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) { if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
// Handle successful scan totalbox.setText(contents)
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel totalbox.setText("@string/bummer");
} } } }
Essentially it is supposed to call zxing Barcode Scanner to scan a barcode on a button click and return the result into an EditText field.
View 2 Replies
View Related
Jun 16, 2009
My activity contains an editable text view and I would like to automatically show the soft keyboard when the activity start. Anyone knows how to do it?
I tried this:
CODE:.....................
View 2 Replies
View Related