user1287195
user1287195

Reputation: 19

How to make home button change to another activity

I'm new to Eclipse and I wanted to see if this was possible.

What I want to do is make a guest mode. When a user uses my app there will be a textBox and a Button. When the user puts in their phone number of choice, I want it to change to the dialer. When the home button is pressed, I want the home button to be redirected to a password activity. How do I do this?

edit- Okay, so maybe I wasn't clear what I meant for my app to do. It's a guest mode so that say that someone asks to use your phone. You can go to this app and they put whoever they want to call in the textbox. When they are finished with their call, it changes to a password activity. That help, or do I need to set it to where when the call ends it changes to the password activity?

Upvotes: 0

Views: 2223

Answers (4)

javamonger
javamonger

Reputation: 31

The only way to prevent the user form reaching the home screen via the home button seems to be, declaring a new launcher activity, which however, a user will have to verify when he uses the home button after installing the concerned app. Declaring the launcher activity can easily be done by adding the intent filter in the manifest:

    <intent-filter>
        <category android:name="android.intent.category.LAUNCHER" />
        <action android:name="android.intent.action.MAIN" />
    </intent-filter>

Even if this is acceptable to you, it still leaves you with the problem of dealing with the recent apps button. Toddler lock seems to have solved that, but I do not know how.

To me this situation is most dissatisfactory, too. Why google does not implement a permissioin based modal app mode is beyond me. It severly limits the range of applicatons the devices may be used for.

Upvotes: 3

Josh
Josh

Reputation: 10738

Yeah, this is a bad idea. Maybe explain a little bit about why you want the home button to go to a password screen? We might be able to suggest a better implementation which fits on Android.

Upvotes: 0

tyczj
tyczj

Reputation: 73753

the home button cannot be overridden nor should it ever because that is the one way a user can completely get out of an application

Upvotes: 0

FoamyGuy
FoamyGuy

Reputation: 46856

There is no legit means for an Application intercept the home button within the Public APIs.

The one and only exception is if you create your application to be an alternate home screen. And then you get your users to set it as the default home screen for their device.

Upvotes: 3

Related Questions