Android :: Specify Which Item Gets Default Focus On Activity Startup?

Apr 11, 2009

How can you specify which item gets the default focus on Activity startup? Using requestFocus programmatically does not work. On setContextView the first focusable item listed in the XML is given the default focus. When using RelativeLayout, the first item listed is not always the desired item or necessarily on top.

Android :: Specify which item gets default focus on Activity startup?


Android :: Set Focus On Any Item Of Listview

Jul 2, 2010

Now i want the first item of the list to be automatically focused when i launch the application How can i set the focus on any item of the list when i click on the some other view for example a button?

View 1 Replies View Related

Android :: How To Run The Focus Item On The View Without Using Onclick

Jul 20, 2009

If I want to execute the focused item on the view, I need to select focused item and press enter. Now I want to find another way to execute it without using click action. Does everyone know the other way? Thank you very much.

View 2 Replies View Related

Android :: List Child Item Focus Change?

Nov 19, 2010

I have a list view which contains different numbers and i have a button below with the name "Call". The expected spec is to change the button background to blue, only if user clicks on list item, and if user clicks on some other views, i need to change the button background to white.

My work around for this issue:

I have set onfocusChangeListener() for the list live, but onFocusChanged() is getting called if next view gets the focus.

Expected result:

1) Background of the button should change to blue if user clicks on list child item.

2) Background of the button should change to white if user clicks on other views.

View 2 Replies View Related

Android :: Load Default Preferences On Startup?

Aug 20, 2009

I want to load default preferences on app startup (before the user hits my preferences screen). Is there a way to do this using possibly xml and the manifest?

View 2 Replies View Related

Android :: Focus In List When First List Item Should Be Disabled

Aug 23, 2010

I use tabs in my Android application and one of my tabs contains a listview. I'm noticing some weird behavior when I override isEnabled in my list's adapter and then try to use the D-pad to move up and down through the list and to my tabs.If the 0th item of the list is enabled, then everything works as expected - I can move down through the list, and then up again and once I reach the top of the list, pressing up moves focus to my tab.However, if the 0th item is DISABLED (isEnabled in my adapter returns false), then when I press up while position 1 is focused, the focus gets stuck. It doesn't move up to the tab as I would have expected and instead stays on position 1 of the list.

View 1 Replies View Related

Android :: Default To Numeric Keypad On Focus Of An Edit Text View?

Jun 13, 2010

I have an Edit Text field for the user to enter their weight in lbs. How can I override the traditional keyboard and display the numeric keypad instead?

View 2 Replies View Related

Android :: Soft Keyboard On Activity Startup

Jan 12, 2010

I am struggling trying to have the soft keyboard appear in a search screen and from the looks of numerous pleas on various forums, I am not the only one. I have tried many variants, culling from the byzantine attempts of those others.

InputMethodManager imm = (InputMethodManager) getSystemService
(Context.INPUT_METHOD_SERVICE); imm.showSoftInput (query, 0);
(for 0, substitute InputMethodManager.SHOW_FORCED or InputMethodManager.SHOW_IMPLICIT.)

The problem seems to be that showSoftInput doesn't work from onCreate. This is a very common need. Surely there is a reasonable solution to this problem, or is it botched here?

View 3 Replies View Related

Android :: How To Scroll To Bottom On Activity Startup?

Jul 22, 2010

I am displaying some data in a ScrollView. On activity startup (method onCreate) I fill the ScrollView with data and want to scroll to the bottom. I tried to use:
getScrollView().fullScroll(ScrollView.FOCUS_DOWN).
This works when I make it as an action on button click but it doesn't work in the onCreate method. Is there any way how to scroll the ScrollView to the bottom on activity startup? That means the view is already scrolled to the bottom when first time displayed.

View 1 Replies View Related

Android :: Set Focus On Running Activity

Mar 24, 2010

I have an Activity that keeps running after the Home button is pressed (naturally) and of-course the focus is in the home screen, and when the running process ends I need to restore the focus on that activity. In more PC expression, I need to maximize the application.

View 1 Replies View Related

Android :: Set Default Value To ListPreference Item

Sep 22, 2010

I'm trying to set a defaultValue to a ListPreference item. Here is an sample of my preference.xml file:

<ListPreference android:key="notification_delai"
android:title="@string/settings_push_delai"
android:entries="@array/settings_push_delai_human_value"
android:entryValues="@array/settings_push_delai_phone_value"
android:defaultValue="????">
</ListPreference>


The two arrays:
<string-array name="settings_push_delai_human_value">
<item>every 5 minutes</item>
<item>every 10 minutes</item>
<item>every 15 minutes</item>
</string-array>.............

View 1 Replies View Related

Android :: Show Dialog When Application / Activity Startup

Aug 24, 2010

Can we show the dialog when our application/activity startup?

View 4 Replies View Related

Android :: Activity With Two Elements - Input Focus

Oct 12, 2009

I have an android activity, with two elements:
EditText
ListView
When my activity starts, the EditText immediately has input focus (flashing cursor). I don't want any control to have input focus at startup. Stop EditText from gaining focus at Activity startup? I tried:
EditText.setSelected(false);
No luck. How can I convince the EditText to not select itself when the Activity starts?

View 5 Replies View Related

Android :: How To Find Out When Activity Starts Or Get Focus?

Mar 17, 2010

I would need to know when one activity starts or get's focus. I need this notification for any activity regardless of his type, name or whatever - not searching for one specific activity. Checked the ActivityMonitor and the Intent and I haven't found a generic intent for this purpose. Or I hadn't understood well the descriptions from the Intent ACTION_xxxxx.

View 7 Replies View Related

Android :: Moving Focus To Top Of Activity - Scrolling

Aug 26, 2009

I have an activity that begins with almost a page of text, then has a few form controls. When the activity launches, the first form control takes focus and the screen scrolls down to make it fully visible. When this happens, the text at the top is off the top edge of the screen. When the screen comes into view, I want the text at the top to be visible. So, onCreate, I tried sending a message to the Activity's overridden handler to do the following:

ScrollView main = (ScrollView) findViewById(R.id.main);
main.pageScroll(ScrollView.FOCUS_UP);
This did nothing. I then tried:
main.scrollTo(0,0); This also did nothing.
I then tried sending the message from onResume instead of onCreate. This also did nothing. How to force the scrollview to actually scroll?

View 3 Replies View Related

Android :: How To Tell Inbox Activity Focus His Rows?

Nov 3, 2009

I know the title it doesn't explain my problem exactily. It's better explain it with an example. I want put up-down arrows over inbox activity. I can select each row in the inbox message list pressing up or down arrow. I'd tried it showing two activities at time starting a new thread, but I can't get it. However, if I could put my arrows another problem appears: how can I tell inbox activity focus his rows? Then, I thought maybe I resolve my problem installing NDK, but I have a lot of problems installing it. Finally, you could think, another solution could be manage myself inbox message list; but this is not an scalable solution for me.

View 4 Replies View Related

Android :: Set Focus On TextView When Activity Starts?

Aug 16, 2010

There are an EditText and a TextView in my Activity. I want to set focus on the TextView when the Activity starts. I used the following code:

TextView myTextView = (TextView) findViewById(R.id.my_text_vew);
myTextView.setFocusable(true);
myTextView.setOnClickListener(this);
myTextView.requestFocus();

But the code doesn't work. The EditText always receives focus when the activity starts.

View 1 Replies View Related

Android : Remove Focus From Current Activity

May 26, 2010

How would i remove the focus from an activity which has just being installed/started,

so the user's focus will remine on the previous one?
(while the new activity remine in the stack and will work in the background)

the prob is that when i start this new background activity, until i wont press back or home, the ui is stuck. and i would like to fix that some how?

View 1 Replies View Related

Android :: Select First Item In A ListView By Default?

Sep 3, 2010

When my app loads, I want the first item in the listview to already be selected. how can I do this?

View 1 Replies View Related

Android :: Simple Program - Class Extends Activity At Startup

Oct 1, 2010

I have a simple activity program in android. Basically the class just extends Activity.
But when I start it I get a ClassCastException in the constructor of my class. I don't even have a constructor defined, so it must be in the constructor of the superclass which is Activity. Unfortunately the debugger doesn't give any detailed information on what class it is trying to cast. Here is the stacktrace:

Thread [<1> main] (Suspended (exception RuntimeException))
ActivityThread$PackageInfo.makeApplication(boolean, Instrumentation) line: 649
ActivityThread.handleBindApplication(ActivityThread$AppBindData) line: 4232
ActivityThread.access$3000(ActivityThread, ActivityThread$AppBindData) line: 125
ActivityThread$H.handleMessage(Message) line: 2071
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 123
ActivityThread.main(String[]) line: 4627
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 521
ZygoteInit$MethodAndArgsCaller.run() line: 868
ZygoteInit.main(String[]) line: 626
NativeStart.main(String[]) line: not available [native method]

And when I look into this runtimeexception I get:

detailMessage "Unable to instantiate application com.test.MyApp: java.lang.ClassCastException: com.test.MyApp" (id=830067694464)
The only code is:
package com.test;
import android.app.Activity;
public class MyApp extends Activity {
}

View 3 Replies View Related

Android :: Stop Timer When Activity Loses Focus

Nov 10, 2010

I have a Timer which executes a TimerTask every 30 seconds. I only want the timer to launch a new TimerTask if the Activity is displayed i.e. if the user receives a phone call or launches a new activity the Timer will stop. I then need the Timer to restart when the Activity is re-launched and comes into focus.

Now this should be easy, I override the "onWindowFocusChanged(boolean hasFocus)" method and either start or stop the timer depending on the value of has Focus. The way I start the timer is to create a new Timer object and TimerTask each time and the way I stop the Timer is to call the cancel() method on the Timer object and set timer to null.

My problem is this doesn't always work, if I launch the activity which has the Timer and switch orientations quickly (to start/stop the Activity) I find the Timer is not always canceled and I end up with multiple Timers launching TimerTasks at an ever increasing rate.

View 2 Replies View Related

Android :: Detect When Another Activity Is Launched Or Loses Focus

Dec 3, 2009

Like the title says, I need to detect when my app loses focus because another app is launched (Phone call comes in, or user hits Home etc.).
Overriding Activity.OnStop does not work because that is called even when switching activities within my app.

View 3 Replies View Related

Android :: Googlemaps View Activity Regain Focus

Nov 24, 2010

I have a problem with my app, it haves a lot of activitys, two of them haves googlemap views. My A activity haves a full mapview and my B activity haves a small map view. OK, when i am on the B activity and press back key somethimes until i return to my A activity, the map of my A activity shows with errors, with a black zone in the down part of the window. THis only happens when i press back from the B activity. Code...

View 1 Replies View Related

Android : How To Ensure View Isn't In Focus When Activity Starts?

Oct 2, 2009

I open an Activity which has a number of elements... some TextViews, some Buttons, and an EditText. For some reason, when the activity starts, the EditText is focused by default, which causes the keypad to appear hiding the screen. I only want this EditText to be in focus if the user clicks into it. How can I ensure that this View isn't in focus when the activity starts? I've tried calling requestFocus() on one of the buttons, but it hasn't changed anything. Ideally, I don't want anything in focus at all.

View 7 Replies View Related

Android : Can I Set A Default Item In Spinner Drop Down List?

Jan 26, 2010

How can I use code to set a default item in a spinner drop down list

View 4 Replies View Related

Android :: How To Give Focus To A Background Activity Belonging To A Different Task

Aug 4, 2010

Say that the user has started my App and then switched off to use the Browser (so we have 2 sets of Tasks running). After a while, something happens to my app that requires the user's attention, so it posts a notification to notify the user. Is there a way to bring my App's task (and the Activity on top of the stack) out from the background when user clicks on my notification?

View 2 Replies View Related

Android :: How To Overwrite Default Background Of List Item In ListView?

Apr 16, 2010

I am trying to overwrite the default backgroud color of List item which is holding the focus in the ListView. As you can see, in Android Setting Menu, when you scroll through the ListView, the focused ListItem has a red backgroud to highlight its focus. Does any way to change the default behavior by highlighting it with other color or just a bottom red line under this Item.

View 5 Replies View Related

Android :: Trap In TabHost When AsyncTask Delays Set Content View At Activity Startup

Nov 3, 2009

I've got a tab host activity started from a home screen shortcut. When my application starts it downloads information from a server using an AsyncTask. In the onPostExecute method of the AsyncTask I call setContentView to display the TabHost.When I start the homescreen shortcut by tapping on the shortcut using my finger everything works as expected, I download the information from the server and display the TabHost with the information in the tabs. However starting the application by navigating to the shortcut with the mouse wheel and then clicking on the shortcut with the mouse wheel leads to a trap in the framework code as soon as my application starts. This looks like a simple fix since mCurrentView is null at the time that this method is called - can this issue be addressed? Does anyone know of any workarounds?

View 5 Replies View Related

Android :: Remove Default Focus Color From GridLayout And EditBox In Android

Jul 21, 2010

I want to remove the default orange focus color from GridView and from the EditText. I have tried the android:focusable="false" but it is not working.

View 1 Replies View Related

Android :: How To Call Activity From A Menu Item In Phone?

Nov 12, 2010

I'm attempting to call start Activity(myIntent) from the click of a menu button but my application crashes at that point. The same start Activity call works fine from a regular button click, so, I assume the menu button is missing information about the context? Or maybe I'm totally off the mark here. So what's the correct way to have a menu item take me to a specific Activity? I've revised my code based on the initial set of advice. Still crashing in the same place. The debugger doesn't enter the exception clause, the app just dies. Code...

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved