当前位置: 首页>>代码示例>>Java>>正文


Java InvalidReferenceException.printStackTrace方法代码示例

本文整理汇总了Java中org.javarosa.core.reference.InvalidReferenceException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java InvalidReferenceException.printStackTrace方法的具体用法?Java InvalidReferenceException.printStackTrace怎么用?Java InvalidReferenceException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.javarosa.core.reference.InvalidReferenceException的用法示例。


在下文中一共展示了InvalidReferenceException.printStackTrace方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDerivedLocation

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
/**
 * Derive a reference from the given location and context; adding it to the
 * vector of references.
 *
 * @param location Contains a reference to a resource.
 * @param context  Provides context for any relative reference accessors.
 *                 Can be null.
 * @param ret      Add derived reference of location to this Vector.
 */
private static void addDerivedLocation(ResourceLocation location,
                                       Reference context,
                                       Vector<Reference> ret) {
    try {
        final Reference derivedRef;
        if (context == null) {
            derivedRef =
                    ReferenceManager._().DeriveReference(location.getLocation());
        } else {
            // contextualize the location ref in terms of the multiple refs
            // pointing to different locations for the parent resource
            derivedRef =
                    ReferenceManager._().DeriveReference(location.getLocation(),
                            context);
        }
        ret.addElement(derivedRef);
    } catch (InvalidReferenceException e) {
        e.printStackTrace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:30,代码来源:ResourceTable.java

示例2: setupAudioButton

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
private void setupAudioButton(int rowId, AudioPlaybackButton audioPlaybackButton, MenuDisplayable menuDisplayable) {
    if (audioPlaybackButton != null) {
        final String audioURI = menuDisplayable.getAudioURI();
        String audioFilename = "";
        if (audioURI != null && !audioURI.equals("")) {
            try {
                audioFilename = ReferenceManager.instance().DeriveReference(audioURI).getLocalURI();
            } catch (InvalidReferenceException e) {
                Log.e("AVTLayout", "Invalid reference exception");
                e.printStackTrace();
            }
        }

        File audioFile = new File(audioFilename);
        // First set up the audio button
        ViewId viewId = ViewId.buildListViewId(rowId);
        if (!"".equals(audioFilename) && audioFile.exists()) {
            audioPlaybackButton.modifyButtonForNewView(viewId, audioURI, true);
        } else {
            audioPlaybackButton.modifyButtonForNewView(viewId, audioURI, false);
        }
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:24,代码来源:MenuAdapter.java

示例3: addDerivedLocation

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
/**
 * Derive a reference from the given location and context; adding it to the
 * vector of references.
 *
 * @param location Contains a reference to a resource.
 * @param context  Provides context for any relative reference accessors.
 *                 Can be null.
 * @param ret      Add derived reference of location to this Vector.
 */
private static void addDerivedLocation(ResourceLocation location,
                                       Reference context,
                                       Vector<Reference> ret) {
    try {
        final Reference derivedRef;
        if (context == null) {
            derivedRef =
                    ReferenceManager.instance().DeriveReference(location.getLocation());
        } else {
            // contextualize the location ref in terms of the multiple refs
            // pointing to different locations for the parent resource
            derivedRef =
                    ReferenceManager.instance().DeriveReference(location.getLocation(),
                            context);
        }
        ret.addElement(derivedRef);
    } catch (InvalidReferenceException e) {
        e.printStackTrace();
    }
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:30,代码来源:ResourceTable.java

示例4: setFullScreen

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
private void setFullScreen() {
    String imageFileURI;

    if (bigImageURI != null) {
        imageFileURI = bigImageURI;
    } else if (imageURI != null) {
        imageFileURI = imageURI;
    } else {
        return;
    }

    try {
        String imageFilename = ReferenceManager.instance()
                .DeriveReference(imageFileURI).getLocalURI();
        File bigImage = new File(imageFilename);

        Intent i = new Intent("android.intent.action.VIEW");
        Uri imageFileUri = FileUtil.getUriForExternalFile(getContext(), bigImage);
        i.setDataAndType(imageFileUri, "image/*");
        i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

        getContext().startActivity(i);
    } catch (InvalidReferenceException e1) {
        e1.printStackTrace();
    } catch (ActivityNotFoundException e) {
        Toast.makeText(
                getContext(),
                getContext().getString(R.string.activity_not_found,
                        "view image"), Toast.LENGTH_SHORT).show();
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:32,代码来源:ResizingImageView.java

示例5: referenceFileExists

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
public static boolean referenceFileExists(String uri) {
    if (uri != null && !uri.equals("")) {
        try {
            return new File(ReferenceManager.instance().DeriveReference(uri).getLocalURI()).exists();
        } catch (InvalidReferenceException e) {
            e.printStackTrace();
        }
    }
    return false;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:11,代码来源:FileUtil.java

示例6: getInlineVideoView

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
/**
 * Creates a video view for the provided URI or an error view elaborating why the video
 * couldn't be displayed.
 *
 * @param inlineVideoURI   JavaRosa Reference URI
 * @param viewLayoutParams the layout params that will be applied to the view. Expect to be
 *                         mutated by this method
 */
private View getInlineVideoView(String inlineVideoURI, RelativeLayout.LayoutParams viewLayoutParams) {
    try {
        final String videoFilename = ReferenceManager.instance().DeriveReference(inlineVideoURI).getLocalURI();

        int[] maxBounds = getMaxCenterViewBounds();

        File videoFile = new File(videoFilename);
        if (!videoFile.exists()) {
            return getMissingImageView("No video file found at: " + videoFilename);
        } else {
            //NOTE: This has odd behavior when you have a text input on the screen
            //since clicking the video view to bring up controls has weird effects.
            //since we shotgun grab the focus for the input widget.

            final MediaController ctrl = new MediaController(this.getContext());

            VideoView videoView = new VideoView(this.getContext());
            videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mediaPlayer) {
                    ctrl.show();
                }
            });
            videoView.setVideoPath(videoFilename);
            videoView.setMediaController(ctrl);
            ctrl.setAnchorView(videoView);

            //These surprisingly get re-jiggered as soon as the video is loaded, so we
            //just want to give it the _max_ bounds, it'll pick the limiter and shrink
            //itself when it's ready.
            viewLayoutParams.width = maxBounds[0];
            viewLayoutParams.height = maxBounds[1];

            videoView.setId(INLINE_VIDEO_PANE_ID);
            return videoView;
        }
    } catch (InvalidReferenceException ire) {
        Log.e(TAG, "invalid video reference exception");
        ire.printStackTrace();
        return getMissingImageView("Invalid reference: " + ire.getReferenceString());
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:51,代码来源:MediaLayout.java

示例7: queryCaseAttachments

import org.javarosa.core.reference.InvalidReferenceException; //导入方法依赖的package包/类
/**
 *
 * @param caseId the caseId of the pertinent case
 * @return a Cursor over the multimedia attachments associated with this case
 */

private Cursor queryCaseAttachments(String caseId) {

    //Demo only, we'll pull this out when we're doing this for real and centralize it/manage its lifecycle more carefully
    SqlStorage<ACase> storage = CommCareApplication.instance().getUserStorage(ACase.STORAGE_KEY, ACase.class);

    //Default projection.
    MatrixCursor retCursor = new MatrixCursor(new String[] {CaseDataAPI.DataColumns._ID,
            CaseDataAPI.DataColumns.CASE_ID,
            "attachment", "jr-source","file-source"});

    Case c;
    try {
        c = storage.getRecordForValue(ACase.INDEX_CASE_ID, caseId);
    } catch(NoSuchElementException nsee) {
        //No cases with a matching index.
        return retCursor;
    }
    int i = 0;

    Vector<String> attachments = c.getAttachments();

    for(String attachment: attachments) {

        String jrSource = c.getAttachmentSource(attachment);

        String fileSource;

        try {
            fileSource = ReferenceManager.instance().DeriveReference(jrSource).getLocalURI();
        } catch (InvalidReferenceException e) {
            e.printStackTrace();
            fileSource = "invalid";
        }

        retCursor.addRow(new Object[] {i, caseId, attachment, jrSource, fileSource});
        ++i;
    }

    return retCursor;

}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:48,代码来源:CaseDataContentProvider.java


注:本文中的org.javarosa.core.reference.InvalidReferenceException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。