user700284
user700284

Reputation: 13620

Text input text is not shown unless it is focused in flex 4.6 android application

I am developing an AIR application for android using flex 4.6 and air 3.1.In the application i have a view in which there is a textinput and a search button.After typing some text and clicking search button will take to the result view.From the result view user can go back to searchview by clicking back button.The destructonPolicy of SearchView is kept as never and I use navigator.popView() to go back to searchview.The problem is when I come back to search view the textinput is empty wherein it should show the txt that was previously typed.But when focus is on the textnput,the text appears. I want the text to be shown as soon as that view is shown again.Any idea why this issue is happening

P.S- This issue is happening when I check aftr installng the apk in an android emulator(OS 2.3.3).I dont have an android device to check this.So not sure if it is just an issue with emulator.If i use flex 4.5.1 sdk this issue is not happening

Here are the codes

Main mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                            xmlns:s="library://ns.adobe.com/flex/spark" firstView="views.HomeView">
</s:ViewNavigatorApplication>

HomeView.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView" destructionPolicy="never">

    <fx:Script>
        <![CDATA[
            protected function button1_clickHandler(event:MouseEvent):void
            {
                navigator.pushView(ResultView);
            }
        ]]>
    </fx:Script>
    <s:layout>
        <s:VerticalLayout horizontalAlign="center"/>
    </s:layout>
    <s:TextInput prompt="Enter some text"/>
    <s:Button label="Search" click="button1_clickHandler(event)"/>
</s:View>

ResultView.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" title="ResultView">

    <fx:Script>
        <![CDATA[
            protected function button1_clickHandler(event:MouseEvent):void
            {
                navigator.popView();

            }
        ]]>
    </fx:Script>

    <s:navigationContent>
        <s:Button label="&lt;" click="button1_clickHandler(event)"/>
    </s:navigationContent>
</s:View>

Upvotes: 4

Views: 1903

Answers (1)

JeffryHouser
JeffryHouser

Reputation: 39408

Since the issue exists on Flex 4.6; but not Flex 4.5 it is probably a side effect/redraw issue with the new default TextInput skins that use StageText. I wrote a bit about that here.

In your 4.6 application, try setting the default Flex 4.5 skin:

<textInput skinClass="spark.skins.mobile.TextInputSkin" />

Upvotes: 5

Related Questions