List of usage examples for java.lang NullPointerException printStackTrace
public void printStackTrace()
From source file:org.opencb.opencga.storage.core.search.solr.SolrQueryParser.java
/** * Create a SolrQuery object from Query and QueryOptions. * * @param query Query/*from w ww. j a v a2 s . co m*/ * @param queryOptions Query Options * @return SolrQuery */ public SolrQuery parse(Query query, QueryOptions queryOptions) { List<String> filterList = new ArrayList<>(); SolrQuery solrQuery = new SolrQuery(); //------------------------------------- // QueryOptions processing //------------------------------------- if (queryOptions.containsKey(QueryOptions.INCLUDE)) { solrQuery.setFields(queryOptions.getAsStringList(QueryOptions.INCLUDE).toString()); } if (queryOptions.containsKey(QueryOptions.LIMIT)) { solrQuery.setRows(queryOptions.getInt(QueryOptions.LIMIT)); } if (queryOptions.containsKey(QueryOptions.SKIP)) { solrQuery.setStart(queryOptions.getInt(QueryOptions.SKIP)); } if (queryOptions.containsKey(QueryOptions.SORT)) { solrQuery.addSort(queryOptions.getString(QueryOptions.SORT), getSortOrder(queryOptions)); } //------------------------------------- // Query processing //------------------------------------- // OR conditions // create a list for xrefs (without genes), genes, regions and cts // the function classifyIds function differentiates xrefs from genes List<String> xrefs = new ArrayList<>(); List<String> genes = new ArrayList<>(); List<Region> regions = new ArrayList<>(); List<String> consequenceTypes = new ArrayList<>(); // xref classifyIds(VariantQueryParams.ANNOT_XREF.key(), query, xrefs, genes); classifyIds(VariantQueryParams.ID.key(), query, xrefs, genes); classifyIds(VariantQueryParams.GENE.key(), query, xrefs, genes); classifyIds(VariantQueryParams.ANNOT_CLINVAR.key(), query, xrefs, genes); classifyIds(VariantQueryParams.ANNOT_COSMIC.key(), query, xrefs, genes); // classifyIds(VariantQueryParams.ANNOT_HPO.key(), query, xrefs, genes); // Convert region string to region objects if (query.containsKey(VariantQueryParams.REGION.key())) { regions = Region.parseRegions(query.getString(VariantQueryParams.REGION.key())); } // consequence types (cts) if (query.containsKey(VariantQueryParams.ANNOT_CONSEQUENCE_TYPE.key()) && StringUtils.isNotEmpty(query.getString(VariantQueryParams.ANNOT_CONSEQUENCE_TYPE.key()))) { consequenceTypes = Arrays .asList(query.getString(VariantQueryParams.ANNOT_CONSEQUENCE_TYPE.key()).split("[,;]")); } // goal: [((xrefs OR regions) AND cts) OR (genes AND cts)] AND ... AND ... if (consequenceTypes.size() > 0) { if (genes.size() > 0) { // consequence types and genes String or = buildXrefOrRegionAndConsequenceType(xrefs, regions, consequenceTypes); if (xrefs.size() == 0 && regions.size() == 0) { // no xrefs or regions: genes AND cts filterList.add(buildGeneAndCt(genes, consequenceTypes)); } else { // otherwise: [((xrefs OR regions) AND cts) OR (genes AND cts)] filterList.add("(" + or + ") OR (" + buildGeneAndCt(genes, consequenceTypes) + ")"); } } else { // consequence types but no genes: (xrefs OR regions) AND cts // in this case, the resulting string will never be null, because there are some consequence types!! filterList.add(buildXrefOrRegionAndConsequenceType(xrefs, regions, consequenceTypes)); } } else { // no consequence types: (xrefs OR regions) but we must add "OR genes", i.e.: xrefs OR regions OR genes // no consequence types: (xrefs OR regions) but we must add "OR genMINes", i.e.: xrefs OR regions OR genes // we must make an OR with xrefs, genes and regions and add it to the "AND" filter list String orXrefs = buildXrefOrGeneOrRegion(xrefs, genes, regions); if (!orXrefs.isEmpty()) { filterList.add(orXrefs); } } // now we continue with the other AND conditions... // type (t) String key = VariantQueryParams.STUDIES.key(); if (isValidParam(query, VariantQueryParams.STUDIES)) { try { String value = query.getString(key); VariantDBAdaptorUtils.QueryOperation op = checkOperator(value); Set<Integer> studyIds = new HashSet<>( variantDBAdaptorUtils.getStudyIds(splitValue(value, op), queryOptions)); List<String> studyNames = new ArrayList<>(studyIds.size()); Map<String, Integer> map = variantDBAdaptorUtils.getStudyConfigurationManager().getStudies(null); if (map != null && map.size() > 1) { map.forEach((name, id) -> { if (studyIds.contains(id)) { String[] s = name.split(":"); studyNames.add(s[s.length - 1]); } }); if (op == null || op == VariantDBAdaptorUtils.QueryOperation.OR) { filterList.add(parseCategoryTermValue("studies", StringUtils.join(studyNames, ","))); } else { filterList.add(parseCategoryTermValue("studies", StringUtils.join(studyNames, ";"))); } } } catch (NullPointerException e) { logger.error(e.getMessage()); e.printStackTrace(); } } // type (t) key = VariantQueryParams.TYPE.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseCategoryTermValue("type", query.getString(key))); } // Gene biotype key = VariantQueryParams.ANNOT_BIOTYPE.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseCategoryTermValue("biotypes", query.getString(key))); } // protein-substitution key = VariantQueryParams.ANNOT_PROTEIN_SUBSTITUTION.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseScoreValue(query.getString(key))); } // conservation key = VariantQueryParams.ANNOT_CONSERVATION.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseScoreValue(query.getString(key))); } // cadd, functional score key = VariantQueryParams.ANNOT_FUNCTIONAL_SCORE.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseScoreValue(query.getString(key))); } // maf population frequency // in the model: "popFreq__1kG_phase3__CLM":0.005319148767739534 key = VariantQueryParams.ANNOT_POPULATION_MINOR_ALLELE_FREQUENCY.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parsePopValue("popFreq", query.getString(key))); } // stats maf // in the model: "stats__1kg_phase3__ALL"=0.02 key = VariantQueryParams.STATS_MAF.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parsePopValue("stats", query.getString(key))); } // GO key = VariantQueryParams.ANNOT_GO.key(); if (StringUtils.isNotEmpty(query.getString(key))) { List<String> gos = Arrays.asList(query.getString(key).split(",")); Set genesByGo = variantDBAdaptorUtils.getGenesByGo(gos); if (genesByGo != null && genesByGo.size() > 0) { filterList.add(parseCategoryTermValue("xrefs", StringUtils.join(genesByGo, ","))); } } // hpo key = VariantQueryParams.ANNOT_HPO.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseCategoryTermValue("traits", query.getString(key))); } // clinvar key = VariantQueryParams.ANNOT_CLINVAR.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseCategoryTermValue("traits", query.getString(key))); } // traits key = VariantQueryParams.ANNOT_TRAITS.key(); if (StringUtils.isNotEmpty(query.getString(key))) { filterList.add(parseCategoryTermValue("traits", query.getString(key))); } //------------------------------------- // Facet processing //------------------------------------- if (query.containsKey("facet.field")) { solrQuery.addFacetField((query.get("facet.field").toString())); } if (query.containsKey("facet.fields")) { solrQuery.addFacetField((query.get("facet.fields").toString().split(","))); } if (query.containsKey("facet.query")) { solrQuery.addFacetQuery(query.get("facet.query").toString()); } if (query.containsKey("facet.prefix")) { solrQuery.setFacetPrefix(query.get("facet.prefix").toString()); } if (query.containsKey("facet.range")) { Map<String, Map<String, Number>> rangeFields = (Map<String, Map<String, Number>>) query .get("facet.range"); for (String k : rangeFields.keySet()) { Number rangeStart = rangeFields.get(k).get("facet.range.start"); Number rangeEnd = rangeFields.get(k).get("facet.range.end"); Number rangeGap = rangeFields.get(k).get("facet.range.gap"); solrQuery.addNumericRangeFacet(k, rangeStart, rangeEnd, rangeGap); } } logger.debug("query = {}\n", query.toJson()); solrQuery.setQuery("*:*"); filterList.forEach(filter -> { solrQuery.addFilterQuery(filter); logger.debug("Solr fq: {}\n", filter); }); return solrQuery; }
From source file:com.slim.turboeditor.activity.MainActivity.java
public void savedAFile(boolean success) { mEditor.clearHistory();/*from w w w.j a v a 2 s .co m*/ mEditor.fileSaved(); invalidateOptionsMenu(); try { closeKeyBoard(); } catch (NullPointerException e) { e.printStackTrace(); } if (success) finish(); }
From source file:edu.harvard.mcz.imagecapture.ImageDisplayFrame.java
/** * This method initializes jComboBoxImagePicker * /*from ww w. ja v a 2s . com*/ * @return javax.swing.JComboBox */ private JComboBox getJComboBoxImagePicker() { if (jComboBoxImagePicker == null) { jComboBoxImagePicker = new JComboBox(); if (targetSpecimen != null) { Iterator<ICImage> i = targetSpecimen.getICImages().iterator(); while (i.hasNext()) { String filename = i.next().getFilename(); jComboBoxImagePicker.addItem(filename); log.debug(filename); } } jComboBoxImagePicker.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { // Intended to be fired when picklist item is selected, is // being fired on other events as well. log.debug(e.getActionCommand()); // If there is no selection, then we shouldn't be doing anything. if (jComboBoxImagePicker.getSelectedItem() == null) { log.debug("No selected item"); } else { ICImage pattern = new ICImage(); try { boolean hasParameter = false; if (jComboBoxImagePicker.getSelectedItem() != null) { pattern.setFilename(jComboBoxImagePicker.getSelectedItem().toString()); hasParameter = true; log.debug("Parameter: " + jComboBoxImagePicker.getSelectedItem().toString()); } if (targetSpecimen != null) { pattern.setSpecimen(targetSpecimen); hasParameter = true; log.debug("Parameter: " + targetSpecimen.getBarcode()); } if (hasParameter) { // find matching images, set first one as the display image. ICImageLifeCycle ils = new ICImageLifeCycle(); List<ICImage> images = ils.findByExample(pattern); if (images != null && images.size() > 0) { log.debug("Found: " + images.size()); Iterator<ICImage> ii = images.iterator(); boolean found = false; while (ii.hasNext() && !found) { ICImage image = ii.next(); if (image.getSpecimen() != null && !image.getSpecimen().getBarcode() .equals(targetSpecimen.getBarcode())) { // same filename, but wrong path. log.debug("WrongFile: " + image.getPath()); } else { found = true; //String startPointName = Singleton.getSingletonInstance().getProperties().getProperties().getProperty(ImageCaptureProperties.KEY_IMAGEBASE); String path = image.getPath(); if (path == null) { path = ""; } File fileToCheck = new File(ImageCaptureProperties .assemblePathWithBase(path, image.getFilename())); PositionTemplate defaultTemplate; try { defaultTemplate = PositionTemplate.findTemplateForImage(image); loadImagesFromFileSingle(fileToCheck, defaultTemplate, image); } catch (ImageLoadException e3) { log.error(e3); } catch (BadTemplateException e1) { log.error(e1); } } } } } } catch (NullPointerException e2) { // Probably means an empty jComboBoxImagePicker e2.printStackTrace(); log.error(e2.getMessage(), e2); } } } }); } return jComboBoxImagePicker; }
From source file:com.zitech.framework.widget.SlidingTabs.java
/** * draw the sliding tabs// w w w . ja va 2s. c om * * @param canvas canvas */ @Override protected void onDraw(Canvas canvas) { // OPPO device may throw nullPointerException here!!! try { super.onDraw(canvas); } catch (NullPointerException e) { e.printStackTrace(); } if (isInEditMode() || this.tabCount == 0) { return; } final int height = getHeight(); // draw underline this.rectPaint.setColor(this.underlineColor); canvas.drawRect(0, height - this.underlineHeight, tabsContainer.getWidth(), height, rectPaint); // draw indicator line this.rectPaint.setColor(this.indicatorColor); // default: line below current tab View currentTab = this.tabsContainer.getChildAt(this.currentPosition); float lineLeft = currentTab.getLeft(); float lineRight = currentTab.getRight(); // if there is an offset, start interpolating left and right coordinates between current and next tab if (this.currentPositionOffset > 0f && this.currentPosition < this.tabCount - 1) { View nextTab = this.tabsContainer.getChildAt(this.currentPosition + 1); final float nextTabLeft = nextTab.getLeft(); final float nextTabRight = nextTab.getRight(); lineLeft = (this.currentPositionOffset * nextTabLeft + (1f - this.currentPositionOffset) * lineLeft); lineRight = (this.currentPositionOffset * nextTabRight + (1f - this.currentPositionOffset) * lineRight); } if (this.indicatorDrawable != null) { int indicatorDrawableWidth = this.indicatorDrawable.getIntrinsicWidth(); this.indicatorDrawable.setBounds((int) (lineLeft + this.tabWidth / 2 - indicatorDrawableWidth / 2), height - this.indicatorDrawable.getIntrinsicHeight(), (int) (lineRight - tabWidth / 2 + indicatorDrawableWidth / 2), height); this.indicatorDrawable.draw(canvas); } else { canvas.drawRect(lineLeft + this.mMyUnderlinePadding, height - this.indicatorHeight, lineRight - this.mMyUnderlinePadding, height, this.rectPaint); } // draw divider this.dividerPaint.setColor(this.dividerColor); for (int i = 0; i < this.tabCount - 1; i++) { View tab = this.tabsContainer.getChildAt(i); canvas.drawLine(tab.getRight(), this.dividerPadding, tab.getRight(), height - this.dividerPadding, this.dividerPaint); } }
From source file:de.chdev.artools.loga.controller.FltrController.java
private boolean checkEventStop(String textWoPrefix, int lineNumber) { Matcher m = patternEventStop.matcher(textWoPrefix.trim()); boolean valid = m.matches(); if (valid) {//from ww w . j a v a 2s . c o m // if // (textWoPrefix.trim().startsWith(keywords.getString("event.stop"))){ LogElement parent = mainController.getLastOpenLogElement(); // Close active operation element if (parent instanceof OperationLogElement) { parent.setEndLineNumber(lineNumber - 2); mainController.closeLastLogElement(); parent = mainController.getLastOpenLogElement(); } // Close active Filter elements if (parent instanceof FilterLogElement) { // Extract Filter information String temp = textWoPrefix; String threadId = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(threadId.length()); String rpcId = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(rpcId.length()); String queue = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(queue.length()); String clientRpc = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(clientRpc.length()); String user = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(user.length()); String overlay = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(overlay.length()); String timestampString = temp.substring(0, temp.indexOf("*/") + 2); temp = temp.substring(timestampString.length()); String fltrText = temp; Long timestamp = mainController.convertToTimestamp( timestampString.substring(3, timestampString.length() - 3).trim(), PREFIX); parent.setEndLineNumber(lineNumber - 2); ((FilterLogElement) parent).setEndTimestamp(timestamp); mainController.closeLastLogElement(); parent = mainController.getLastOpenLogElement(); } // Extract Filter information String temp = textWoPrefix; String threadId = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(threadId.length()); String rpcId = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(rpcId.length()); String queue = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(queue.length()); String clientRpc = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(clientRpc.length()); String user = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(user.length()); String overlay = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(overlay.length()); String timestampString = temp.substring(0, temp.indexOf("*/") + 2); temp = temp.substring(timestampString.length()); String phaseString = temp.substring(temp.indexOf("(") + 1, temp.indexOf(")")); temp = temp.substring(temp.indexOf(")") + 4); String fltrText = temp.trim(); Long timestamp = mainController .convertToTimestamp(timestampString.substring(3, timestampString.length() - 3).trim(), PREFIX); if (parent instanceof ControlLogElement) { ControlLogElement clElement = (ControlLogElement) parent; clElement.setEndLineNumber(lineNumber); clElement.setEndTimestamp(timestamp); mainController.closeLastLogElement(); // Load last primary event clElement = eventCache.peek(); try { if (clElement.isPhase2Available() == false && clElement.isPhase3Available() == false) { eventCache.pop(); } else if (clElement.isPhase3Available() == false && phaseString.equalsIgnoreCase("phase 2")) { eventCache.pop(); } else if (phaseString.equalsIgnoreCase("phase 3")) { eventCache.pop(); } } catch (NullPointerException npe) { System.out.println("Parent event not available"); npe.printStackTrace(); } } else { System.out.println("Error during filter event close in line " + lineNumber); } return true; } else { return false; } }
From source file:de.chdev.artools.loga.controller.FltrController.java
private boolean checkEventReStart(String textWoPrefix, int lineNumber) { Matcher m = patternEventReStart.matcher(textWoPrefix.trim()); boolean valid = m.matches(); if (valid) {//w w w .j ava2 s.c o m // Extract Filter information String temp = textWoPrefix; String threadId = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(threadId.length()); String rpcId = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(rpcId.length()); String queue = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(queue.length()); String clientRpc = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(clientRpc.length()); String user = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(user.length()); String overlay = temp.substring(0, temp.indexOf(">") + 1); temp = temp.substring(overlay.length()); String timestampString = temp.substring(0, temp.indexOf("*/") + 2); temp = temp.substring(timestampString.length()); String phaseString = temp.substring(temp.indexOf("(") + 1, temp.indexOf(")")); temp = temp.substring(temp.indexOf(")") + 4); String fltrText = temp.trim(); Long timestamp = mainController .convertToTimestamp(timestampString.substring(3, timestampString.length() - 3).trim(), PREFIX); // LogElement parent = // MainController.getInstance().getLastOpenLogElement(); LogElement parent; try { if (phaseString.equalsIgnoreCase("phase 2")) { parent = eventCache.peek().getParentLogElement(); } else { parent = eventCache.peek().getParentLogElement(); } } catch (NullPointerException npe) { parent = null; System.out.println("Parent element not available"); npe.printStackTrace(); } // Create event name String name = "Event - (" + phaseString + ") - " + fltrText; // Create new ControlLogElement ControlLogElement clElement = new ControlLogElement(); clElement.setElementAlias("FLTR"); clElement.setElementType(LogElementType.EVENT); clElement.setName(name); clElement.setParentLogElement(parent); clElement.setStartLineNumber(lineNumber); clElement.setStartTimestamp(timestamp); clElement.setValid(true); clElement.setText(textWoPrefix); // TODO Is this part relevant? // // Close parent Filter Operation Element if exist // if (parent instanceof OperationLogElement){ // parent.setEndLineNumber(lineNumber-2); // MainController.getInstance().closeLastLogElement(); // parent = MainController.getInstance().getLastOpenLogElement(); // } mainController.openNewLogElement(clElement); // eventCache.push(clElement); return true; } else { return false; } }
From source file:App.java
protected ImageIcon scaleBufferedImageWithoutLabel(BufferedImage img) { ImageIcon icon = null;/*w w w. j av a 2 s . c om*/ try { icon = new ImageIcon(img); double width = icon.getIconWidth(); double height = icon.getIconHeight(); double labelWidth = 150; double labelHight = 150; double scaleWidth = width / labelWidth; double scaleHeight = height / labelHight; if (width >= height) { // horizontal image double newWidth = width / scaleWidth; icon = new ImageIcon(icon.getImage().getScaledInstance((int) newWidth, -1, Image.SCALE_SMOOTH)); } else { // vertical image double newHeight = height / scaleHeight; icon = new ImageIcon(icon.getImage().getScaledInstance(-1, (int) newHeight, Image.SCALE_SMOOTH)); } } catch (NullPointerException e) { try { originalImage = (BufferedImage) ImageIO.read(new File("img/error.png")); } catch (IOException e2) { e2.printStackTrace(); } e.printStackTrace(); } return icon; }
From source file:com.snt.bt.recon.activities.MainActivity.java
public <T> void syncSQLiteMySQLDB(final Class<T> cl, final String postString, final String postURL) { //Create AsycHttpClient object AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); //Sync Trips//from w ww .ja v a2 s . co m try { List<T> list = db.getAll(cl); if (list.size() != 0) { if (db.dbSyncCount(cl) != 0) { if (menu != null) menu.findItem(R.id.menu_refresh_server) .setActionView(R.layout.actionbar_progress_indeterminate); params.put(postString, db.composeJSONfromSQLite(cl)); // using a socket factory that allows self-signed SSL certificates. client.setSSLSocketFactory(MySSLSocketFactory.getFixedSocketFactory()); client.post(postURL, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(int i, Header[] headers, byte[] response) { logDebug("DatabaseTest", "Server response " + postString + " : " + new String(response)); try { JSONArray arr = new JSONArray(new String(response)); for (int x = 0; x < arr.length(); x++) { JSONObject obj = (JSONObject) arr.get(x); db.updateSyncStatus(cl, obj); } logDebug("DatabaseTest", postString + " : DB Sync completed!"); T inst = cl.newInstance(); if (sessionId != null && inst instanceof Trip) { logDebug("DatabaseTest", "Session in progress -> Deleting old trips.."); db.deleteOldTrips(sessionId); } if (menu != null) menu.findItem(R.id.menu_refresh_server).setActionView(null); } catch (JSONException e) { logDebug("DatabaseTest", postString + " : Error Occured [Server's JSON response might be invalid]!"); e.printStackTrace(); } catch (InstantiationException | IllegalAccessException | NullPointerException e) { e.printStackTrace(); } } @Override public void onFailure(int statusCode, Header[] headers, byte[] response, Throwable e) { if (statusCode == 404) { logDebug("DatabaseTest", postString + " : Requested resource not found"); } else if (statusCode == 500) { logDebug("DatabaseTest", postString + " : Something went wrong at server end"); } else { logDebug("DatabaseTest", postString + " : Unexpected Error occcured! [Most common Error: Device might not be connected to Internet]"); } try { if (menu != null) menu.findItem(R.id.menu_refresh_server).setActionView(null); } catch (NullPointerException error) { error.printStackTrace(); } } }); } else { logDebug("DatabaseTest", postString + " : SQLite and Remote MySQL DBs are in Sync!"); } } else { logDebug("DatabaseTest", postString + " : No data in DB, nothing to Sync"); } } catch (InstantiationException | IllegalAccessException | NullPointerException e) { e.printStackTrace(); } }
From source file:com.inovex.zabbixmobile.activities.BaseActivity.java
@Override public void onLoginFinished(boolean success, boolean showToast) { if (mLoginProgress != null && mLoginProgress.isAdded()) { try {// ww w .ja va 2s .c om mLoginProgress.dismiss(); } catch (NullPointerException e) { // in case the progress is not being shown right now, a // NullPointerException will be thrown, which we can safely // ignore. } catch (IllegalStateException e) { // if the activity has been canceled, this exception will be // thrown e.printStackTrace(); } } if (success) { // if (showToast) // Toast.makeText(this, R.string.zabbix_login_successful, // Toast.LENGTH_LONG).show(); loadData(); } }
From source file:com.rsmsa.accapp.MainActivity.java
/** * Display image from a path to ImageView *///from w w w. ja va 2 s . c o m private void previewCapturedImage() { try { // hide video preview videoPreview.setVisibility(View.GONE); imgPreview.setVisibility(View.VISIBLE); // bitmap factory BitmapFactory.Options options = new BitmapFactory.Options(); // downsizing image as it throws OutOfMemory Exception for larger // images options.inSampleSize = 8; final Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath(), options); getResizedBitmap(bitmap, 640, 1024); } catch (NullPointerException e) { e.printStackTrace(); } }