Code example for NdefRecord

0
        PackageManager pm = context.getPackageManager();
        List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0);
        if (activities.isEmpty()) {
            return null; 
        } 
 
        ResolveInfo info = activities.get(0);
        ((ImageView) root.findViewById(R.id.image)).setImageDrawable(info.loadIcon(pm));
        ((TextView) root.findViewById(R.id.text)).setText(context.getString(R.string.photo));
 
        root.setTag(new ImageRecordEditInfo());
        return root;
    } 
 
    public static ImageRecord parse(NdefRecord record) {
        MimeRecord underlyingRecord = MimeRecord.parse(record);
        Preconditions.checkArgument(underlyingRecord.getMimeType().startsWith("image/"));
 
        // Try to ensure it's a legal, valid image 
        byte[] content = underlyingRecord.getContent();
Experience pair programming with AI  Get Codota for Java