Tag: android-activity

Android PayPalActivity not Fullscreen

I’m trying to include a PayPal donate button in my app (launching it from an actionbar button), it does work as it should, but…it just shows the PayPalActivity as a very small popup, while it should be almost fullscreen by default! Let me explain better… I use the usual piece of code to start the […]

Android: how to prevent multiple instances of an activity to be launched from a widget?

Steps to reproduce the issue: the user launches my app (name of the root activity: “mainActivity”) => instance A of mainActivity he presses the home button (mainActivity running in background) he installs the widget relative to this app he clicks on the widget => a new instance of mainActivity (instance B) is displayed he clicks […]

Why does resuming an activity in android cause BadTokenException?

Folks – Can anyone explain this stack? Note that my code is nowhere on it. If you Google for any of these exceptions, everyone who has experiencing this issue was trying to create dialogs after an activity was terminated, which doesn’t seem to be the case here. It’s just a simple activity resume. I am […]

Android – Fadeout animation for splash screen

I want to add fadeout animation for my splash screen, that is while closing the splash screen I want to bring the fadeout animation effect. Here are the codes which I have tried. overridePendingTransition(R.anim.fade_in, R.anim.fade_out); But the above can be used only from 2.0. Ny app should support from 1.5. So I have set the […]

How to find out which Activity is on top of the stack using Robotium/Android SDK?

I have a Robotium test for an Android application, which extends ActivityInstrumentationTestCase2. The test operates on a loop, randomly clicking on active views. I would like to verify at the start of each iteration which Activity is currently focused. This behavior is important for me because one of the buttons is capable of starting another […]

Ok to update fragments instead of creating new instances?

In the example on using fragments in the Android docs, when the application is in ‘dualview’ mode, the details fragment is recreated whenever the application needs to show details for a different title. FragmentTransaction.replace() is used to swap out each old details fragment instance with a new one. Is this recommended practice? Isn’t it wasteful […]

How to exclude my own Activity from Activity.startActivity(Intent) chooser?

My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app. As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent). […]

Restarting Android application after process is killed

When my application is idle, Android kills the process. If user reopens the application after some time, only the top Activity is created – this is a problem for me because the activity depends on initialization of other objects (which are now destroyed). What I want to do in that case is to re-launch the […]

Android app architecture – where to put REST API call code?

I want to better understand how to structure an Android app where an activity fires off an API call (for example). I’d currently implement it by putting the API call into an AsyncTask subclass, passing it a reference to the activity so it can update the UI in onPostExecute. But my gut-feel is that this […]

Best practices for Android Unit Testing?

I am developing a mobile android app. What are the most common libraries/frameworks used for Android unit testing? I feel that most of the business logic, database testing, Web services testing can all be done using JUnit. However, what’s the best approach for testing UI, the UI workflow, etc? For example, how can we test […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.