android - code not running properly -


"Launch canceled" error for some time gets caught in the 'Open Time Sheet' button btn01 is. Any help is appreciated.

TimeSheet.java

  package com.example.TimeSheet; Import android.app.activity; Import android.content.Intent; Importroid.os.Bundle; The public class expands the timekeeping activity {/ ** calls are made when activity is created first. * / @ Override Crate on Public Zero (Bundle Saved Instantstate) {Super. Contents (Saved Instantstate); SetContentView (R.layout.main); Beginner (new intent (this, menuExample.class)); }}  

MenuExample.java

  package com.example.TimeSheet; Import android.app.activity; Importroid.os.Bundle; Import android.view.ContextMenu; Import android.view.Menu; Import android.view.MenuItem; Import android.view.View; Import android.view.ContextMenu.ContextMenuInfo; Import android.widget.Button; Android Import; Toast; Public class menu enhances menu synchronization activity {@ Override Crate on Public Zero (Bundle Saved Instant) {super.onCreate (savedInstanceState); SetContentView (R.layout.menu); Button BTN = (button) VVBIID (RID.btn1); Btn.setOnCreateContextMenuListener (this); } Private Zero CreateMenu (menu menu) {menu.setQwertyMode (true); MenuItem mnu1 = menu.add (0, 0, 0, "Fill time sheet"); {Mnu1.setAlphabeticShortcut ('A'); Mnu1.setIcon (R.drawable.icon1); } Menu item mnu2 = menu.ed (0, 1, 1, "check time sheet"); {Mnu2.setAlphabeticShortcut ('b'); Mnu2.setIcon (R.drawable.icon2); } MenuItem mnu3 = menu.add (0, 2, 2, "Exit Time Sheet"); {Mnu3.setAlphabeticShortcut ('c'); Mnu3.setIcon (R.drawable.icon3); }} Private Boolean menu Choice (menu item) {switch (itat. ITMID)} {Case 0: Toast. Make text (this, "you click on Item 1", Toast. LNNHT_LLG). Show (); Return true; Case 1: Toast. Make text (this, "you click on item 2", toast.lnnggh_LOG). Show (); Return true; Case 2: Toast. Make text (this, "You clicked on Item 3", Toast. LNNGH_LOG). Show (); Return true; }         return false; } // Using the context menu / * @ Override Creative Options menu on the public boolean (menu menu) {Super.Nocrate Options menu (menu); CreateMenu (menu); Return true; } * / @ Override public boolean on option etam selected (menu item) {Return Menu Choice (item); } Clear the override public on the @coretextext menu (context menu menu, view view, ContactMenuPoint menuinfo) {super. Correct Context Menu (menu, view, menuinfo); CreateMenu (menu); } @ Override Public Boolean On Context Items Selection (menu item) {Return menu Choice (item); }}  

main.xml

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: Orientation = "Vertical" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; / LinearLayout & gt;  

menu.xml

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: Orientation = "Vertical" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" & gt; & Lt; Android Android: id = "@ + id / btn1" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" android: text = "open time sheet" /> & Lt; / LinearLayout & gt;  

..................................
[2010 -09-27 00:51:57 -Timesheets] Home device is on 'Emulator-5554' - Online [2010-09-27 00:51:57 - Time Sheet] Upload Device 'emulator -5554' TimeSheet .apk
[2010-09-27 00:52:08 - Time Sheet] Failed to upload TimeSheet.apk to device 'emulator-5554' -
[2010-09-27 00:52:08 - Time Sheet] Java.Oo .IOException: unable to upload file: Faucet

[2010-09-27 00:52:08 - Timesthat] Launch canceled!

In Eclipse, go to window - Preferences -> Android -> DDS -> ADB Connection Timeout

Set something big, like 10000 (MS).

I had one problem and it solved it.


Comments