Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3495] Android: exception occurs when opening preview on Nexus S 2.3

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-05-03T12:47:27.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-14
ComponentsAndroid
Labels2.3, android, camera, crash, defect, preview, release-1.7.0, reported-1.6, rplist
ReporterOpie Cyrus
AssigneeOpie Cyrus
Created2011-04-15T03:45:53.000+0000
Updated2011-05-03T12:47:27.000+0000

Description

Nexus S crashes when launching preview. Exception received:

E/TiUncaughtHandler(  711): (main) [0,1313] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to resume activity {com.appcelerator.base/ti.modules.titanium.media.TiCameraActivity}: java.lang.NullPointerException; Titanium 1.0,N/A,N/A
E/TiUncaughtHandler(  711): java.lang.RuntimeException: Unable to resume activity {com.appcelerator.base/ti.modules.titanium.media.TiCameraActivity}: java.lang.NullPointerException
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2095)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2110)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1643)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2796)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.access$1600(ActivityThread.java:117)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:932)
E/TiUncaughtHandler(  711):   at android.os.Handler.dispatchMessage(Handler.java:99)
E/TiUncaughtHandler(  711):   at android.os.Looper.loop(Looper.java:123)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.main(ActivityThread.java:3647)
E/TiUncaughtHandler(  711):   at java.lang.reflect.Method.invokeNative(Native Method)
E/TiUncaughtHandler(  711):   at java.lang.reflect.Method.invoke(Method.java:507)
E/TiUncaughtHandler(  711):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/TiUncaughtHandler(  711):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/TiUncaughtHandler(  711):   at dalvik.system.NativeStart.main(Native Method)
E/TiUncaughtHandler(  711): Caused by: java.lang.NullPointerException
E/TiUncaughtHandler(  711):   at ti.modules.titanium.media.TiCameraActivity.onResume(TiCameraActivity.java:89)
E/TiUncaughtHandler(  711):   at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
E/TiUncaughtHandler(  711):   at android.app.Activity.performResume(Activity.java:3833)
E/TiUncaughtHandler(  711):   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2085)
E/TiUncaughtHandler(  711):   ... 13 more
E/jdwp    (  738): Failed sending reply to debugger: Broken pipe
D/dalvikvm(  738): Debugger has detached; object registry had 1 entries
E/AndroidRuntime(  711): FATAL EXCEPTION: main
E/AndroidRuntime(  711): java.lang.RuntimeException: Unable to resume activity {com.appcelerator.base/ti.modules.titanium.media.TiCameraActivity}: java.lang.NullPointerException
E/AndroidRuntime(  711):   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2095)
E/AndroidRuntime(  711):   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2110)
E/AndroidRuntime(  711):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1643)
E/AndroidRuntime(  711):   at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2796)
E/AndroidRuntime(  711):   at android.app.ActivityThread.access$1600(ActivityThread.java:117)
E/AndroidRuntime(  711):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:932)
E/AndroidRuntime(  711):   at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  711):   at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  711):   at android.app.ActivityThread.main(ActivityThread.java:3647)
E/AndroidRuntime(  711):   at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  711):   at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  711):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(  711):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(  711):   at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  711): Caused by: java.lang.NullPointerException
E/AndroidRuntime(  711):   at ti.modules.titanium.media.TiCameraActivity.onResume(TiCameraActivity.java:89)
E/AndroidRuntime(  711):   at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
E/AndroidRuntime(  711):   at android.app.Activity.performResume(Activity.java:3833)
E/AndroidRuntime(  711):   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2085)
E/AndroidRuntime(  711):   ... 13 more
W/ActivityManager(  114):   Force finishing activity com.appcelerator.base/ti.modules.titanium.media.TiCameraActivity
W/ActivityManager(  114):   Force finishing activity com.appcelerator.base/.BaseActivity
var overlay = Titanium.UI.createView();
var tag = Titanium.UI.createView({
  backgroundColor: '#fff',
  borderColor: '#000',
  height: 50,
  width: 150,
  top: 100,
  left: 25
});
var tag_text = Titanium.UI.createLabel({
  text: tag.left,
  color: '#000',
  textAlign: 'center',
  width: 140,
  height: 'auto'
  });
var button = Titanium.UI.createButton({
  bottom: 0,
  color: '#000',
  height: 50,
  title: 'Test',
  width: 100
});
 
button.addEventListener('click', function (event)
{
  tag.left = tag.left + 50;
  tag_text.text = tag.left;
});
 
tag.add(tag_text);
overlay.add(tag);
overlay.add(button);
 
Titanium.Media.showCamera({
  overlay: overlay,
  showControls: false,
  mediaTypes: Titanium.Media.MEDIA_TYPE_PHOTO,
  autohide: false
});

Comments

  1. Opie Cyrus 2011-04-15

    (from [e12c3155c16d09a523c86a1b70f335fac7868838]) [#3494 state:in-progress][#3495 state:in-progress] manually specify camera preview size

    when using custom overlay camera preview, manually set preview size to largest supported preview size for that device
    https://github.com/appcelerator/titanium_mobile/commit/e12c3155c16d09a523c86a1b70f335fac7868838"> https://github.com/appcelerator/titanium_mobile/commit/e12c3155c16d...

  2. Opie Cyrus 2011-04-15

    Issue resolved by latest update to #1781

    https://github.com/appcelerator/titanium_mobile/commit/976a1fae259e742a71609d010f8f3631346c3da8"> https://github.com/appcelerator/titanium_mobile/commit/976a1fae259e...

  3. Don Thorp 2011-05-03

    Tested on Nexus One 2.3.3

JSON Source