Android UsbAccessory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android UsbAccessory class.

This code example shows how to use the following methods:equals
This code example shows how to use the following methods:equals
This code example shows how to use the following methods:getManufacturer, getModel, getVersion
            mModel = model;
            mVersion = version;
        } 
 
        public AccessoryFilter(UsbAccessory accessory) {
            mManufacturer = accessory.getManufacturer();
            mModel = accessory.getModel();
            mVersion = accessory.getVersion();
        } 
 
        public static AccessoryFilter read(XmlPullParser parser)
                throws XmlPullParserException, IOException { 
            String manufacturer = null;
            String model = null;
            String version = null;
 
            int count = parser.getAttributeCount();
            for (int i = 0; i < count; i++) {
                String name = parser.getAttributeName(i);
                String value = parser.getAttributeValue(i);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals
		 
	} 
	 
	public boolean matchesThisAccessory(Intent intent) { // TODO: Name this something better
		UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
		return accessory != null && accessory.equals(mAccessory);
	} 
	 
	 
	public boolean hasPermission(Object theAccessoryObj) {
		return mUsbManager.hasPermission((UsbAccessory) theAccessoryObj);
	} 
	 
	public Object getConnectedAccessory() {
		UsbAccessory[] accessories = mUsbManager.getAccessoryList();
		UsbAccessory accessory = (accessories == null ? null : accessories[0]);
		return accessory;
	} 
 
	public Object getAccessory() {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals
	public boolean matchesThisAccessory(Intent intent) { // TODO: Name this something better
 
        Log.d(this.getClass().getSimpleName(), "In matchesThisAccessory mAccessory is: " + mAccessory);
 
		UsbAccessory accessory = (UsbAccessory) intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
		return (accessory != null) && accessory.equals(mAccessory);
	} 
 
 
	public boolean hasPermission(Object theAccessoryObj) {
		return mUsbManager.hasPermission((UsbAccessory) theAccessoryObj);
	} 
 
	public Object getConnectedAccessory() {
		UsbAccessory[] accessories = mUsbManager.getAccessoryList();
		UsbAccessory accessory = (accessories == null ? null : accessories[0]);
		return accessory;
	} 
 
	public Object getAccessory() {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:equals
		public void onReceive(Context context, Intent intent) {
			String action = intent.getAction();
			if (UsbManager.ACTION_USB_ACCESSORY_DETACHED.equals(action)) {
				UsbAccessory accessory = (UsbAccessory)
		                   intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
				if (accessory != null && accessory.equals(mAccessory)) {
					Log.i(TAG, "closing accessory");
				} 
			} 
		} 
	}; 
	 
	protected class ListenerTask extends AsyncTask<InputStream, String, Void> {
		@Override 
		protected Void doInBackground(InputStream... params) {
			byte[] buffer = new byte[1024];
			InputStream lis = params[0];
			int r_idx;
			int res = 0;
			int idx = 0;
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getManufacturer, getModel
            mDisplaySourceService = null;
        } 
    } 
 
    private static boolean isSink(UsbAccessory accessory) {
        return MANUFACTURER.equals(accessory.getManufacturer())
                && MODEL.equals(accessory.getModel());
    } 
 
    class TextLogger extends Logger {
        @Override 
        public void log(final String message) {
            Log.d(TAG, message);
 
            mLogTextView.post(new Runnable() {
                @Override 
                public void run() { 
                    mLogTextView.append(message);
                    mLogTextView.append("\n");
                } 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getManufacturer, getModel, getVersion
            mModel = model;
            mVersion = version;
        } 
 
        public AccessoryFilter(UsbAccessory accessory) {
            mManufacturer = accessory.getManufacturer();
            mModel = accessory.getModel();
            mVersion = accessory.getVersion();
        } 
 
        public static AccessoryFilter read(XmlPullParser parser)
                throws XmlPullParserException, IOException { 
            String manufacturer = null;
            String model = null;
            String version = null;
 
            int count = parser.getAttributeCount();
            for (int i = 0; i < count; i++) {
                String name = parser.getAttributeName(i);
                String value = parser.getAttributeValue(i);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android UsbAccessory Questions & Answers:

See Code Examples for Android UsbAccessory Methods: