Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1959] Android: Date picker with Holo theme crashes after making a reference to the ActionBar

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-01-24T06:50:17.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterAlex M
AssigneeRitu Agrawal
Created2013-01-09T02:52:06.000+0000
Updated2016-03-08T07:40:53.000+0000

Description

*Steps to reproduce* Create a Holo-themed app with these tiapp.xml, themes.xml and app.js: *themes.xml*
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Holo.Light">
    </style>
</resources>
*tiapp.xml*
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <id>com.picker</id>
    <name>Picker</name>
    <version>1.0</version>
    <publisher>home_ced</publisher>
    <url>http://</url>
    <description>not specified</description>
    <copyright>2012 by home_ced</copyright>
    <icon>appicon.png</icon>
    <persistent-wifi>false</persistent-wifi>
    <prerendered-icon>false</prerendered-icon>
    <statusbar-style>default</statusbar-style>
    <statusbar-hidden>false</statusbar-hidden>
    <fullscreen>false</fullscreen>
    <navbar-hidden>false</navbar-hidden>
    <analytics>true</analytics>
    <guid>e42a5920-c4b9-4dbb-b2ab-fc5c3e3f6153</guid>
    <property name="ti.ui.defaultunit" type="string">system</property>
    <iphone>
        <orientations device="iphone">
            <orientation>Ti.UI.PORTRAIT</orientation>
        </orientations>
        <orientations device="ipad">
            <orientation>Ti.UI.PORTRAIT</orientation>
            <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
            <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
            <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>
    </iphone>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <tool-api-level>14</tool-api-level>
        <manifest>
            <application android:theme="@style/LightTheme"/>
        </manifest>
    </android>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules/>
    <deployment-targets>
        <target device="blackberry">false</target>
        <target device="android">true</target>
        <target device="ipad">false</target>
        <target device="iphone">true</target>
        <target device="mobileweb">false</target>
    </deployment-targets>
    <sdk-version>3.0.0.GA</sdk-version>
</ti:app>
*app.js*
var win = Titanium.UI.createWindow({
	fullscreen : false
});

var button = Titanium.UI.createButton({
	title : 'Hello',
	top : 10,
	width : 100,
	height : 50
});

win.add(button);

var picker = Ti.UI.createPicker({
	type : Ti.UI.PICKER_TYPE_DATE
});

win.addEventListener('open', function() {
	var actionBar = win.activity.actionBar;
});

button.addEventListener('click', function(e) {
	picker.showDatePickerDialog();
});

win.open();
*Log*
(KrollRuntimeThread) [27525,27525] Sending event: exception on thread: KrollRuntimeThread msg:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

Comments

  1. Nikhil Sharma 2013-02-05

    Hi Alex, What device have you tested on? I tested it on android 4.1.1 and it's not crashing. Please provide the device name.
  2. Alex M 2013-02-07

    I've tested on two devices : a Nexus S running 4.1.2 and a Galaxy SII running 4.0.3. I didn't crash on Galaxy Nexus (4.2)
  3. Ritu Agrawal 2014-01-23

    Reopening it to test with 3.2.0 release.
  4. Ritu Agrawal 2014-01-23

    I tried to reproduce this issue with Nexus S running Android 4.1.2 but was not able to reproduce. Its working as expected. Please let us know if this is still an issue for you with the latest release 3.2.0 GA.
  5. Markus 2014-04-08

    I have the same issue, this exception only raised on hardware devices. The emulator works well. My environment is Titanium 3.2.2. and my Hardware devices are Nexus 5 and Samsung Galaxy S4 both Crash. Steps to reproduce 1. Focus Textarea 2. Type something in the textarea 3. click on another View to open showTimePickerDialog Result [ERROR][TiApplication(17350)] (KrollRuntimeThread) [16699,100845] Sending event: exception on thread: KrollRuntimeThread msg:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.; Titanium 3.2.2,2014/03/05 12:22,96e9a07 [ERROR][TiApplication(17350)] android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. Let me know if you need a code example.
  6. Markus 2014-04-08

    I have the same issue, this exception only raised on hardware devices. The emulator works well. My environment is Titanium 3.2.2. and my Hardware devices are Nexus 5 and Samsung Galaxy S4 both Crash. Steps to reproduce 1. Focus Textarea 2. Type something in the textarea 3. click on another View to open showTimePickerDialog Result [ERROR][TiApplication(17350)] (KrollRuntimeThread) [16699,100845] Sending event: exception on thread: KrollRuntimeThread msg:android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.; Titanium 3.2.2,2014/03/05 12:22,96e9a07 [ERROR][TiApplication(17350)] android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. Let me know if you need a code example.
  7. Ritu Agrawal 2014-04-23

    [~m.bahl] Please provide us a test case to reproduce your error as we cannot reproduce this issue with the original test case.

JSON Source