Creating setup wizard on Android App - java

In my application I need to ask the user some information in the beginning. Like Google asks users when they first launch the phone.
Using Java and Android, how do I make the same kind of setup wizard for my application? I could create multiple activities and when moving to the next page in the wizard I'd launch that. That doesn't seem a good way to do it.
I'd like to use Eclipse's GUI builder to design it.
Like This Image

create one activity for the setup wizard, and you change the content with fragments, or you open the setup wizard activity again with intent (close the existing one) and you pass some parameters, based on those parameters you show different content or you could use this https://github.com/romannurik/android-wizardpager

Related

I could do two different NavDrawers in the same Android App?

my problem is that:
I want to make a login service in my application and depending on which user logs in, go to a different NavDrawer activity. In Android Studio when you create the NavDrawer activity that comes by default, it generates one perfectly. But when I want to generate a different one, having the same name doesn't create anything.
The only way I have found is by refactoring everything generated by the Android Studio wizard and changing all the names of the layouts.
I would like to know if there is an easier way to create another NavDrawer without having to refactor so much and without so many errors.
Thank you!
NavDrawers Generated
Conceptual Scheme
Its Solved, you only need to make an instance of one of these nav drawers and then extend that to another one.

How to Identify a button that doesn't get identified through Android uiautomateviewer?

I am trying to automate an Android app with Android UIAutomator. When i tried to identify objects via android uiautomateviewer it doesn't list details of all the objects on the page, rather it gives me the details of the main frame. Buttons that are located inside that frame does not capture through Android uiautomateviewer.
Question: Is there are way to identify buttons that were located inside that frame ?
Can we use UiSelector method for this purpose? If yes how?
Is the a web app or a web page? If so, UiAutomator can't read those.
If it's a normal app (it happened to me with one app I had on my phone), then it's a problem with the app itself (not sure what exactly).
In order to fully answer your question: if it's not visible/detected by UiAutomatorViewer then it's not visible/detected by UiAutomator.
One example of this: when a pop-up is opened we usually can still see the contents behind it. However, for UiAutomatorViewer and UiAutomator, that pop-up is the only thing that's currently on the screen.

Open blackberry device options programmatically

App details:
I am writing an app that requires the user to have a device password set. The company distributes blackberry devices to its associates who will then use them to report on sales etc. The company wants to make sure that the device password is set so that the confidential information can not be easily accessed by anyone if they steal the phone. The app must not work if the password is not set, which is easy enough.
The problem:
The company wants the a message to come up saying "Please set a device password" and then direct the user to the device to the options menu to show them where to set their device password. Doing this seems troublesome
What I have tried so far:
I have looked into the ApplicationManager object, which allows you to bring an application to the foreground. However when I use the following code to see what applications are available:
ApplicationManager manager = ApplicationManager.getApplicationManager();
ApplicationDescriptor descriptors[] = manager.getVisibleApplications();
for(int i=0;i<descriptors.length;i++)
{
String applicationName= descriptors[i].getName();
System.out.println("applicationName");
}
The only visible applications are stuff like Phone, Messages, Blackberry Messages, Home Screen etc, but the options application is not present, which leads me to believe its not accessable from here. (If I'm wrong please let me know)
I have also taken a look at the Invoke.invokeApplication(appType, args) method, however the API does not have an appType constant for the options, or settings etc. The API specifies only the following types and I cannot find the one I need:
APP_TYPE_ADDRESSBOOK
APP_TYPE_BLUETOOTH_CONFIG
APP_TYPE_CALCULATOR
APP_TYPE_CALENDAR
APP_TYPE_CAMERA
APP_TYPE_MAPS
APP_TYPE_MEMOPAD
APP_TYPE_MESSAGES
APP_TYPE_PHONE
APP_TYPE_SEARCH
APP_TYPE_TASKS
I have scanned the API docs and I cannot find anything that looks right. Ive searched for Device and Options and Settings but none of the hits are relevant.
If anyone knows what to do then let me know.
Unfortunately there's no standard API to invoke this screen programmatically. But there's a workaround. Use EventInjector to inject a sequence of keyboard events to open Options screen.
This way is not an elegant one, but I think it is the only workaround in this case.
UPDATE:
I would implement the following approach. Upon application startup I would check, whether device is password protected via DeviceInfo.isPasswordEnabled().
If device is not password protected I would display message: Device is not password protected. Please set password for your device in the device Options. And launch the application again.
I understand, this way is not elegant, but it is reliable and provides full information to the customers, how to use this application properly.
Ok so as it turns out you can run internal apps using the ApplicationManager, so I launched the Options app using the following code:
ApplicationManager.getApplicationManager().launch("net_rim_bb_options_app");
However this only launches the Options app, and does not navigate the user to the Security section.
The following blurb from this page helped me understand what this method really does:
Starting
A BlackBerry application can be started in a number of ways:
by the system automatically on device startup
by another application
by the system at a scheduled time
Regardless of how an application is started, the Application Manager is responsible for starting the process the application will run within.
The ApplicationManager class enables applications to interact with the Application Manager to perform tasks, including:
run an application immediately or at a scheduled time
interact with processes, including retrieving the IDs for foreground applications
post global events to the system
Entry points
The Application Manager starts an application by getting a new process and spawning a thread within that process to call one of the entry points of the application. For many applications, the main() method of its application class is the single entry point that is called. But you can configure more than one entry point for an application.
Using more than one entry point lets you create different ways for a user to start an application. For example, if your application allows users to create a new document, you might like to provide users with two icons that they can click to start the application. Users could click one icon to open the application to its home screen and the other icon to open the application to the screen required to create a new document.
Summary
So basically this method just runs the main method of the app, and supplies the arguments in the main method. It is my suspicion that the main method of the Options app does not allow for you to supply the page you want to open up on as an argument in the main method.
There is no documentation (as far as I can tell) on what arguments the options app takes, so short of guessing how it can be used, it seems that directing the user here and giving them some instructions on how to navigate further is my only option
u_u

Eclipse RCP authentication

I would like to know how to implement authentication in Eclipse RCP. I have started an app and I have two views, one for admin and one for a regular user. At startup I want to show the login dialog and depending of type of user to show a view. Can anyone tell me which is the best way to do that? Thanks!
I'll suggest you that create a single view for both admin and regular user . Just create different widgets for the admin and regular user . Before creating the view just hook the Login Dialog and on the basis of authentication from the login dialog load the widgets in the view .
There are many different ways to do this :-)
I usually recommend using activities as these are completely independent of the code for the view, perspectives, commands, etc.
See this blog entry on how to set-up the activities.

change my home in android if my application is running!

I want to change my home in android device my requirements are like following
whenever I run my application my that time on pressing home key should be disabled
so that time on pressing home key should do nothing.
but if I close that application my home should be the previous one that is launcher
So it is possible on basis of running application my home get set
I use to change in manifest.xml file and disabling the package com.android.launcher but it won't satisfy me.
Long story short... no, you cannot do this.
There are some things you can do as workarounds that would themselves be hacky at best and basically not deliver the functionality you want. Like making your application be home replacement (launcher) itself then applying the desired functionality but even in that scenario it wouldn't do what you described you want done because you wouldn't really ever get back to the previous user defined home app (launcher) and there would be system dialogs the user would need to traverse to set your app as the home replacement (launcher).
Just so it is super clear though, you cannot override the functionality of the home button without the user confirming the action.

Categories

Resources