public PinScreen() {

		UiApplication.getUiApplication().invokeAndWait(new Runnable() {
			public void run() {
				// request file permission
				try {
					ApplicationPermissionsManager apm = ApplicationPermissionsManager
							.getInstance();
					ApplicationPermissions original = apm
							.getApplicationPermissions();
					if (original
							.getPermission(ApplicationPermissions.PERMISSION_FILE_API) == ApplicationPermissions.VALUE_DENY) {
						ApplicationPermissions permRequest = new ApplicationPermissions();
						permRequest
								.addPermission(ApplicationPermissions.PERMISSION_FILE_API);
						apm.invokePermissionsRequest(permRequest);
					}
					if (original
							.getPermission(ApplicationPermissions.PERMISSION_INTERNET) == ApplicationPermissions.VALUE_DENY) {
						ApplicationPermissions permRequest = new ApplicationPermissions();
						permRequest
								.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
						apm.invokePermissionsRequest(permRequest);
					}
				} catch (Exception e) {
					// System.exit(0);

				}
			}
		});
		// end of permission request

		logoImage = ImageFactory.createImage(Bitmap
				.getBitmapResource("stackarena.png"));
		appImage = ImageFactory.createImage(Bitmap
				.getBitmapResource("logo.png"));
		// contactImage =
		// ImageFactory.createImage(Bitmap.getBitmapResource("contacts.png"));
		// aboutImage =
		// ImageFactory.createImage(Bitmap.getBitmapResource("logo.jpg"));

		// set acceptable directions
		int acceptableDirections = 0;
		acceptableDirections = acceptableDirections | Display.DIRECTION_NORTH;
		UiEngineInstance ui = Ui.getUiEngineInstance();
		ui.setAcceptableDirections(acceptableDirections);

		// run verification check
		// sleep for 5secs
		// run update check
		Runnable updt = new Runnable() {
			public void run() {
				try {
				} catch (final Exception e) {
				}
				AppNetwork AppN = new AppNetwork();
				AppN.silent = true;
				AppN.UpdateApp();
			}
		};
		// end of update thread
		// run verify check
		Runnable ver = new Runnable() {
			public void run() {
				try {
				} catch (final Exception e) {
				}
				AppNetwork AppN = new AppNetwork();
				AppN.silent = true;
				AppN.Verification();
			}
		};
		// end of verify thread
		// start the thread
		new Thread(updt).start();
		new Thread(ver).start();

		// listener for button click
		listener = new FieldChangeListener() {
			public void fieldChanged(Field field, int context) {
				try {
					SendPinMsg();
				} catch (Exception e) {
					System.out.println(e.toString());
				}
			}
		};

		/*
		 * *****************************
		 * Begin Screen elements ******************************
		 */
		// here is the colored header
		HeaderField header = new HeaderField("Pin Broadcast");
		// here we set a vertical field manager that we can use for the for
		// contents
		VerticalFieldManager vfm = new VerticalFieldManager(USE_ALL_WIDTH
				| VERTICAL_SCROLL) {
			public void paint(Graphics graphics) {
				graphics.setBackgroundColor(0x455163);
				graphics.clear();
				subpaint(graphics);
			}

		};
		// the status bar
		info = new LabelField("Idle...", LabelField.ELLIPSIS
				| LabelField.HCENTER | LabelField.USE_ALL_WIDTH);

		// the Send message button to click
		btnSend = new ButtonField("Send", ButtonField.CONSUME_CLICK
				| ButtonField.FIELD_RIGHT);
		btnSend.setChangeListener(listener);

		// set trial count label
		lblTrial = new LabelField("", LabelField.ELLIPSIS
				| LabelField.FIELD_VCENTER) {
			public void paint(Graphics graphics) {
				graphics.setColor(0xffffff);

				super.paint(graphics);
			}
		};

		// lblTrial.setMargin(10, 0, 0, 10);
		// lblTrial.setFont(lblTrial.getFont().derive(Font.STYLE_BOLD));
		// set a new column field that displays below the app.
		TableLayoutManager colFMgr = new TableLayoutManager(new int[]

		{ (int) TableLayoutManager.USE_PREFERRED_SIZE,
				TableLayoutManager.USE_PREFERRED_SIZE,

		}, Manager.NO_HORIZONTAL_SCROLL | Manager.USE_ALL_WIDTH);
		colFMgr.setMargin(7, 15, 7, 15);

		// now we need to design the status screen
		VerticalFieldManager statusScreen = new VerticalFieldManager(
				USE_ALL_WIDTH | VERTICAL_SCROLL) {
			public void paint(Graphics graphics) {
				graphics.setBackgroundColor(0x70819d);
				graphics.clear();
				subpaint(graphics);
			}

		};
		statusScreen.add(colFMgr);

		// textbox for from
		from = new CustomTextBox();
		from.height = 45;
		from.topPadding = 8;
		from.bottomMargin = 5;
		from.editField.setMaxSize(50);

		// textbox for subject
		subj = new CustomTextBox();
		subj.height = 45;
		subj.topPadding = 8;
		subj.bottomMargin = 5;
		subj.editField.setMaxSize(100);

		// the textbox to type msgs
		msgs = new CustomTextBoxML();
		msgs.height = 200;
		msgs.topPadding = 8;
		msgs.bottomMargin = 5;
		msgs.editField.setMaxSize(5000);
		msgs.bottomMargin = 10;

		// add everything to the screen now
		vfm.add(header);
		vfm.add(info);

		// set title and status
		setTitle(vfm);
		setStatus(statusScreen);

		// use this to wrap the color for the screen
		negManager = new NegativeMarginVerticalFieldManager(USE_ALL_WIDTH
				| VERTICAL_SCROLL);
		_manager = (VerticalFieldManager) getMainManager();
		Background bg = BackgroundFactory.createSolidBackground(0xe3e3e3);
		_manager.setBackground(bg);
		_manager.add(negManager);

		// the remaining screen objects
		lblFrom = new LabelField("From:", LabelField.ELLIPSIS
				| LabelField.USE_ALL_WIDTH);
		lblFrom.setMargin(10, 0, 0, msgs.leftMargin);
		lblFrom.setFont(lblFrom.getFont().derive(Font.STYLE_BOLD));

		lblSubject = new LabelField("Subject:", LabelField.ELLIPSIS
				| LabelField.USE_ALL_WIDTH);
		lblSubject.setMargin(10, 0, 0, msgs.leftMargin);
		lblSubject.setFont(lblSubject.getFont().derive(Font.STYLE_BOLD));

		lblMessage = new LabelField("Message:", LabelField.ELLIPSIS
				| LabelField.USE_ALL_WIDTH);
		lblMessage.setMargin(10, 0, 0, msgs.leftMargin);
		lblMessage.setFont(lblMessage.getFont().derive(Font.STYLE_BOLD));

		lblTo = new LabelField("To:", LabelField.ELLIPSIS);
		lblTo.setMargin(10, 10, 0, msgs.leftMargin);
		lblTo.setFont(lblTo.getFont().derive(Font.STYLE_BOLD));

		// file button
		_buttonField = new ButtonField("Choose File...",
				ButtonField.CONSUME_CLICK | ButtonField.NEVER_DIRTY);
		_buttonField.setChangeListener(this);

		BitmapField cntImg = new BitmapField(
				Bitmap.getBitmapResource("contacts.png"), BitmapField.RIGHT);
		cntImg.setMargin(0, msgs.rightMargin, 0, 0);
		HorizontalFieldManager hf = null;
		hf = new HorizontalFieldManager();
		hf.add(lblTo);
		hf.add(_buttonField);
		hf.add(cntImg);
		// appImage..paint(graphics, (fieldWidth-58)/2, 0, 58, fieldHeight);

		// _labelfield is the display of the file path
		_labelField = new LabelField("", LabelField.ELLIPSIS
				| LabelField.USE_ALL_WIDTH);
		_labelField.setMargin(5, 0, 0, msgs.leftMargin);

		_manager.setMargin(15, 0, 15, 0);
		_manager.add(hf);
		_manager.add(_labelField);
		_manager.add(new SeparatorField());
		_manager.add(lblFrom);
		_manager.add(from);
		_manager.add(lblSubject);
		_manager.add(subj);
		_manager.add(lblMessage);
		_manager.add(msgs);

		// Add send button under
		colFMgr.add(lblTrial);
		colFMgr.add(btnSend);

		/*
		 * *****************************
		 * End of Screen elements ******************************
		 */

		// Get the FilePicker instance
		_filePicker = FilePicker.getInstance();

		// Set the file picker to only display txt files
		_filePicker.setFilter(".txt");
		try {
			// Obtain the default system document directory to open
			// the file picker in.
			String path = System.getProperty("fileconn.dir.documents");

			// Set the directory to open the file picker in if the
			// directory exists
			FileConnection fconn = (FileConnection) Connector.open(path);
			if (fconn.exists()) {
				_filePicker.setPath(path);
			}
		} catch (final Exception ioe) {
			/*
			 * UiApplication.getUiApplication().invokeLater(new Runnable() {
			 * public void run() {
			 * Dialog.alert("Could not find your documents directory"+
			 * ioe.toString()); } });
			 */
		}

		// Make this class a file picker listener
		_filePicker.setListener(this);

		// initialize app, trial module
		Runnable trlMod = new Runnable() {
			public void run() {
				try {
				} catch (final Exception e) {
				}
				initializeApp();
			}
		};
		// start the thread
		new Thread(trlMod).start();

	}