I have an application that I just would like to use in portrait mode, so I have defined android:screenOrientation="portrait" in the manifest XML. This works OK for the HTC magic phone (and prevents orientation changes on other phones as well).
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Friday, June 8, 2012
How to disable orientation change in Android?
Using Intent in an Android application to show another activity
In my Android application, I have two activity classes. I have a button on the first one and I want to show the second when it is clicked, but I get an error. Here are the classes:
Friday, April 27, 2012
Make Android Activity looks like dialog
I am trying to open a dialog on widget click. I have solved the problem skinning the activity started on click with android:theme="@android:style/Theme.Dialog"
. Unfortunately I cannot reach the same look of a dialog.
Sunday, April 8, 2012
Android lifecycle weirdness with singleTop and foreground service?
Here's the scenario:
- Start Activity A
- Activity A starts service S
- Service S runs in foreground mode and shows up a notification which when pressed takes the user to Activity B (which has launchMode="singleTop")
- Activity B shows up
- Press HOME
- Go into DDMS and kill your application process to simulate that your app died (press red STOP button)
- Android will say "Rescheduling crashed service in 5000ms" (sometimes longer)
- Service S restarts and notification is shown.
- Press the notification icon when the service restarts...
Thursday, March 1, 2012
Android: how to open new intent from ListView, hosted in TabHost, inside same FrameLayout?
I looked through tons of articles how to open new Activity from ListView hosted by TabHost.
Monday, February 27, 2012
Android Activity causing Service crash due to heap fragmentation
I have an Android app (activity) which also has a corresponding service. The service is started by the activity and is supposed to run continuously even when the activity is stopped. When the activity is started again it can bind to the service and query it.
Thursday, February 16, 2012
Android - Running heavy computations in background and returning the result to an Activity
I have implemented some computationaly heavy functions into my application. Depending on the type of input it can take up to several minutes for a thread to return. During this time, I want the user to be able to work with other activities to perform different tasks (i.e. prepare data for the next run). Then, after the Service has finished it's computations, the user should be notified with a Toast that the result is ready and that he should check back to the Activity he started the Service in. Unfortunately I'm stuck at this point.
Contexts, AsyncTask and rotation changes
Is it a good practice to use getApplicationContext()
working with AsyncTask in order to do not have to attach and detach the Activity to avoid memory leaks when rotation changes occur and the Activity is destroyed ? I thing it should be correct, as I actually need a Context that depends on the hole application, not the Activity itself.
Tuesday, February 14, 2012
Can I have an activity create another activity and wait for it to return information?
I want the user to be able to click a button and move to a different activity to input some information and then press a button to "submit" that information to the previous screen.
Friday, January 20, 2012
Android Exception trying to open a new Activity - Surface::lock failed, already locked
When I try to open a new activity on a button press i get an Exception :
Tuesday, January 17, 2012
android, uninstall and install into the same activity?
I am trying to do an upgrade version process for apk files ...
SQLite and Activity updates
I have a neat, working SQLite database on Android that records species observations. I am then using JSON (successfully) to verify observations entered against a set of parameters on a remote database. On verification, a flag in the database is updated to say that this process has been done. But, when I view my main activity (Text, the values for observations with flags after verification don't update.