• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Search app through icom

Or ask him/her what it is. If you want a quick answer, that's the way to get it.

And if you can't do that, or don't believe the answer, that's a bigger problem than the identity of the app.

(As ocnbrze has said, there are a vast number of apps that use icons like this, so searching is a waste of time. And we also get literally hundreds of these queries - yours was the second new one I spotted yesterday evening alone - and have to disappoint most of them).

What app is this notification icon?

I have saw and heard scuttle but about it snd even stopped into a couple of Metro PCS . STORES AND INQUIRED ABOUT IT !! BUT HAVE ONLY GOT DIFFERENT OPINIONS ABOUT IT FROM ALL IVE ASKED !!! Sorry !! If I do finally get a positive response I will fly you a kite ok ?? If you should discover a true answer please don't hesitate to get me back in the know !! @ or ; good luck !! Have a great day !!

Thank You...

Black screen when playing video on Android 4.4 (API 19) kitkat

Im only getting a black screen when playing video on Android 4.4 (API 19). Not sure what is happening. Works fine on Android 9 (API 28)

Im using Android studio with the mediaplayer library. But im having the same issue using react-native-video with react-native.

I need to install and run this on an older Android version Android 4.4 (API 19) kitkat.

I read this https://developer.android.com/guide/topics/media/media-formats so I changed the profile in my encoding from H.264 AVC Main Profile to H.264 AVC Baseline Profile (BP). But no difference.

Im testing on emulator via android studio. I have got no device with that os. Android 4.4 Version.api: 19 (Google API) and resolution 1920 x 1080

Huawei Honor 10 Lite No 4g LTE

According to this. the international variant Honor 10 Lite you've got does NOT support 4G with MetroPCS, but apparently it does support 3G with that carrier.
https://www.frequencycheck.com/carr...2-hry-l22-huawei-henry/metropcs-united-states

metro.png


As you're only getting 2G EDGE with this phone on Metro, could be carrier doesn't have 3G service in your area?

Does MetroPCS publish any coverage maps for their network? MetroPCS is an MVNO on the T-Mobile network isn't it?

invoke vittual method java.lang.string java. lang.toString ()' on Null object reference

Bonjour à tous,

Je suis nouveau dans le fabuleux monde de la création d'application android. Je débute avec SKETCHWARE et après avoir suivi un tuto pour créer une base de données avec firebase, en lançant l'application et en allant sur une des pages de mon Menu, cette erreur apparaît :

" Attempt To invoke vittual method java.lang.string java. lang.toString ()' on Null object reference
At
Com.my.newProject.ProduitsActivity
$listview1Adapter.getView(ProduitsActivity.java:293) "


Je ne trouve pas mon erreur,

Pourriez vous m'apporter vos lumières s'il vous plait . Je n'arrive plus à avancer dans mon projet.

Merci d'avance.
Charly.

voici mon code :

package com.my.newproject;

import android.app.*;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.content.*;
import android.graphics.*;
import android.media.*;
import android.net.*;
import android.text.*;
import android.util.*;
import android.webkit.*;
import android.animation.*;
import android.view.animation.*;
import java.util.*;
import java.text.*;
import android.support.v7.app.AppCompatActivity;
import android.widget.LinearLayout;
import android.widget.Button;
import java.util.Timer;
import java.util.TimerTask;
import android.content.Intent;
import android.net.Uri;
import android.animation.ObjectAnimator;
import android.view.animation.LinearInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.BounceInterpolator;
import android.view.View;

public class MainActivity extends AppCompatActivity {

private Timer _timer = new Timer();

private double rotation = 0;
private double click = 0;
private double xbk = 0;

private LinearLayout linear1;
private LinearLayout linear2;
private Button menu;
private LinearLayout linear3;
private LinearLayout linear4;
private Button button8;
private Button button2;
private Button button3;
private Button button4;
private Button button5;
private Button button6;

private TimerTask timer;
private Intent intent = new Intent();
private ObjectAnimator ani = new ObjectAnimator();
private Intent show = new Intent();
@override
protected void onCreate(Bundle _savedInstanceState) {
super.onCreate(_savedInstanceState);
setContentView(R.layout.main);
initialize(_savedInstanceState);
initializeLogic();
}

private void initialize(Bundle _savedInstanceState) {

linear1 = (LinearLayout) findViewById(R.id.linear1);
linear2 = (LinearLayout) findViewById(R.id.linear2);
menu = (Button) findViewById(R.id.menu);
linear3 = (LinearLayout) findViewById(R.id.linear3);
linear4 = (LinearLayout) findViewById(R.id.linear4);
button8 = (Button) findViewById(R.id.button8);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);

menu.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {
click++;
if (click == 1) {
ani.setTarget(linear4);
ani.setPropertyName("translationX");
ani.setFloatValues((float)(SketchwareUtil.getDip(getApplicationContext(), (int)(-200)) - SketchwareUtil.getDisplayWidthPixels(getApplicationContext())), (float)(0 - SketchwareUtil.getDisplayWidthPixels(getApplicationContext())));
ani.setDuration((int)(500));
ani.setRepeatMode(ValueAnimator.REVERSE);
ani.setRepeatCount((int)(0));
ani.setInterpolator(new AccelerateInterpolator());
ani.start();
}
else {
if (click == 2) {
ani.setTarget(linear4);
ani.setFloatValues((float)(0 - SketchwareUtil.getDisplayWidthPixels(getApplicationContext())), (float)(SketchwareUtil.getDip(getApplicationContext(), (int)(-200)) - SketchwareUtil.getDisplayWidthPixels(getApplicationContext())));
ani.start();
click = 0;
}
}
}
});

button8.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {

}
});

button2.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {
intent.setClass(getApplicationContext(), DonneesActivity.class);
startActivity(intent);
}
});

button3.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {
intent.setClass(getApplicationContext(), ClientsActivity.class);
startActivity(intent);
}
});

button4.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {
intent.setClass(getApplicationContext(), ProduitsActivity.class);
startActivity(intent);
}
});

button5.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {
intent.setClass(getApplicationContext(), EditionfactdevActivity.class);
startActivity(intent);
}
});

button6.setOnClickListener(new View.OnClickListener() {
@override
public void onClick(View _view) {
intent.setClass(getApplicationContext(), VisuelfactdevActivity.class);
startActivity(intent);
}
});
}
private void initializeLogic() {
click = 0;
}

@override
protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) {
super.onActivityResult(_requestCode, _resultCode, _data);

switch (_requestCode) {

default:
break;
}
}

@override
public void onBackPressed() {
xbk++;
if (xbk == 2) {
xbk = 2;
finish();
}
else {
SketchwareUtil.showMessage(getApplicationContext(), "Presser 2 fois pour quitter !");
}
}
@Deprecated
public void showMessage(String _s) {
Toast.makeText(getApplicationContext(), _s, Toast.LENGTH_SHORT).show();
}

@Deprecated
public int getLocationX(View _v) {
int _location[] = new int[2];
_v.getLocationInWindow(_location);
return _location[0];
}

@Deprecated
public int getLocationY(View _v) {
int _location[] = new int[2];
_v.getLocationInWindow(_location);
return _location[1];
}

@Deprecated
public int getRandom(int _min, int _max) {
Random random = new Random();
return random.nextInt(_max - _min + 1) + _min;
}

@Deprecated
public ArrayList<Double> getCheckedItemPositionsToArray(ListView _list) {
ArrayList<Double> _result = new ArrayList<Double>();
SparseBooleanArray _arr = _list.getCheckedItemPositions();
for (int _iIdx = 0; _iIdx < _arr.size(); _iIdx++) {
if (_arr.valueAt(_iIdx))
_result.add((double)_arr.keyAt(_iIdx));
}
return _result;
}

@Deprecated
public float getDip(int _input){
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _input, getResources().getDisplayMetrics());
}

@Deprecated
public int getDisplayWidthPixels(){
return getResources().getDisplayMetrics().widthPixels;
}

@Deprecated
public int getDisplayHeightPixels(){
return getResources().getDisplayMetrics().heightPixels;
}

}

Attachments

  • erreur sketchware 1.jpg
    erreur sketchware 1.jpg
    142.3 KB · Views: 187

Emulator won't display my Hello World app

Since I never seemed to notice any benefit from adding the resources tags and related code, I have removed them. Still I have no ability to bring up my app on the emulator.
Here's my code before removing the resources code: (activity_main.xml)

Code:
<?xml version="1.0" encoding="utf-8"?>

<resources>
    <item name="workouttype" type="id" />
    <item name="txthello" type="id"/>
</resources>

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <EditText
        android:id="@+id/editTextFirstName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="First Name"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <EditText
        android:id="@+id/editTextLastName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Last Name"
        app:layout_constraintStart_toStartOf="@+id/editTextFirstName"
        app:layout_constraintTop_toBottomOf="@+id/editTextFirstName" />

    <EditText
        android:id="@+id/editTextEmail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Email"
        app:layout_constraintEnd_toEndOf="@+id/editTextLastName"
        app:layout_constraintStart_toStartOf="@+id/editTextLastName"
        app:layout_constraintTop_toBottomOf="@+id/editTextLastName" />

    <Button
        android:id="@+id/btnRegister"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp"
        android:text="Register"
        app:layout_constraintEnd_toEndOf="@+id/editTextEmail"
        app:layout_constraintStart_toStartOf="@+id/editTextEmail"
        app:layout_constraintTop_toBottomOf="@+id/editTextEmail" />

    <TextView
        android:id="@+id/textViewFirstName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp"
        android:text="First Name"
        app:layout_constraintEnd_toEndOf="@+id/btnRegister"
        app:layout_constraintStart_toStartOf="@+id/btnRegister"
        app:layout_constraintTop_toBottomOf="@+id/btnRegister" />

    <TextView
        android:id="@+id/textViewLastName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="Last Name"
        app:layout_constraintEnd_toEndOf="@+id/textViewFirstName"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="@+id/textViewFirstName"
        app:layout_constraintTop_toBottomOf="@+id/textViewFirstName" />

    <TextView
        android:id="@+id/textViewEmail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:text="Email"
        app:layout_constraintEnd_toEndOf="@+id/textViewLastName"
        app:layout_constraintStart_toStartOf="@+id/textViewLastName"
        app:layout_constraintTop_toBottomOf="@+id/textViewLastName" />
</androidx.constraintlayout.widget.ConstraintLayout>

How do you delete apps from play store library?

Only one way:!!!

Install “My Phone Explore” in the system.

Install “My Phone Explorer client” from Play Store in your phone

Try to find out the mouse clicking software “AutoMouseKey” or also named as “Automatic Mouse and Keyboard 5.2.9.2” ( find portable cracked version to full access)

Connect the phone via USB ( no other methods wouldn’t works – in Control Phone/Load screen Shot in the My Phone Explore)


After connect the phone go to the phone’s playstore and select the library.

Load screen shot from Tools

Write a script via “Automatic Mouse and Keyboard 5.2.9.2” ( it is very easy ; all are in GUI) (pointing the mouse over the X mark and write delete action via keyboard)

Loop the script, delete all library items one by one.


That’s it..

Help How can I show the time in big numbers while logged-in?

Wait! I got the forum's search feature to work, and I found the answer. You can display the time using a "widget": https://androidforums.com/threads/clock-clock.1119127/

-TC

On Motorola phones that is called the "Time and Weather" widget. Just long-press on the Home screen and scroll down till you see "Time and Weather", then drag it to your home screen.

Android Auto

Im not sure what else would need blue tooth in his case.

You can disable this app. Swipe down, settings, apps&notifications, see all apps, Android Auto

Or there is the "Driving Mode" setting

To set it up on the Pixel 3:

  1. Open the Settings app.
  2. Tap Connected devices > Connection preferences > Driving mode.
  3. Tap Behavior. Choose 'Open Android Auto' or 'Turn on Do Not Disturb'
  4. Tap Turn on Automatically. Choose how you would like your phone to detect driving.

Passing an object of a Usb Service to another activity

Hello,
I'm new to Android development and I'm attempting to pass an object of a USB service from one activity to another.

I've attempted to do it two ways thus far. Implementing Parcelable and Implementing Serializable. Both means cause the system to throw and exception. In regards to Serializable, it threw an IOException.

Here is the code for my USBService, care of Felhr85.

Code:
package com.ascenzi.usb_serial_testing;

import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.TextView;

import com.felhr.usbserial.CDCSerialDevice;
import com.felhr.usbserial.UsbSerialDevice;
import com.felhr.usbserial.UsbSerialInterface;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

import java.util.HashMap;
import java.util.Map;

//import okio.Buffer;

public class UsbService extends Service implements Serializable
{

    public static final String TAG = "UsbService";

    public static final String ACTION_USB_READY = "com.felhr.connectivityservices.USB_READY";
    public static final String ACTION_USB_ATTACHED = "android.hardware.usb.action.USB_DEVICE_ATTACHED";
    public static final String ACTION_USB_DETACHED = "android.hardware.usb.action.USB_DEVICE_DETACHED";
    public static final String ACTION_USB_NOT_SUPPORTED = "com.felhr.usbservice.USB_NOT_SUPPORTED";
    public static final String ACTION_NO_USB = "com.felhr.usbservice.NO_USB";
    public static final String ACTION_USB_PERMISSION_GRANTED = "com.felhr.usbservice.USB_PERMISSION_GRANTED";
    public static final String ACTION_USB_PERMISSION_NOT_GRANTED = "com.felhr.usbservice.USB_PERMISSION_NOT_GRANTED";
    public static final String ACTION_USB_DISCONNECTED = "com.felhr.usbservice.USB_DISCONNECTED";
    public static final String ACTION_CDC_DRIVER_NOT_WORKING = "com.felhr.connectivityservices.ACTION_CDC_DRIVER_NOT_WORKING";
    public static final String ACTION_USB_DEVICE_NOT_WORKING = "com.felhr.connectivityservices.ACTION_USB_DEVICE_NOT_WORKING";
    public static final int MESSAGE_FROM_SERIAL_PORT = 0;
    public static final int CTS_CHANGE = 1;
    public static final int DSR_CHANGE = 2;
    private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
    private static final int BAUD_RATE = 115200; // BaudRate. Change this value if you need
    public static boolean SERVICE_CONNECTED = false;

    private IBinder binder = new UsbBinder();

    private Context context;
    private Handler mHandler;
    private UsbManager usbManager;
    private UsbDevice device;
    private UsbDeviceConnection connection;
    private UsbSerialDevice serialPort;

    private TextView t1;

    //private Buffer buffer = new Buffer();
    private String mode;

    private boolean serialPortConnected;

    /*
     *  Data received from serial port will be received here. Just populate onReceivedData with your code
     *  In this particular example. byte stream is converted to String and send to UI thread to
     *  be treated there.
     */
    private UsbSerialInterface.UsbReadCallback mCallback = new UsbSerialInterface.UsbReadCallback() {
        @Override
        public void onReceivedData(byte[] arg0) {
            try {
                String data = new String(arg0, "UTF-8");
                if (mHandler != null)
                    mHandler.obtainMessage(MESSAGE_FROM_SERIAL_PORT, data).sendToTarget();
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
    };

    /*
     * State changes in the CTS line will be received here
     */
    private UsbSerialInterface.UsbCTSCallback ctsCallback = new UsbSerialInterface.UsbCTSCallback() {
        @Override
        public void onCTSChanged(boolean state) {
            if(mHandler != null)
                mHandler.obtainMessage(CTS_CHANGE).sendToTarget();
        }
    };

    /*
     * State changes in the DSR line will be received here
     */
    private UsbSerialInterface.UsbDSRCallback dsrCallback = new UsbSerialInterface.UsbDSRCallback() {
        @Override
        public void onDSRChanged(boolean state) {
            if(mHandler != null)
                mHandler.obtainMessage(DSR_CHANGE).sendToTarget();
        }
    };
    /*
     * Different notifications from OS will be received here (USB attached, detached, permission responses...)
     * About BroadcastReceiver: http://developer.android.com/reference/android/content/BroadcastReceiver.html
     */
    private final BroadcastReceiver usbReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            if (arg1.getAction().equals(ACTION_USB_PERMISSION)) {
                boolean granted = arg1.getExtras().getBoolean(UsbManager.EXTRA_PERMISSION_GRANTED);
                if (granted) // User accepted our USB connection. Try to open the device as a serial port
                {
                    Intent intent = new Intent(ACTION_USB_PERMISSION_GRANTED);
                    arg0.sendBroadcast(intent);
                    connection = usbManager.openDevice(device);
                    new ConnectionThread().start();
                } else // User not accepted our USB connection. Send an Intent to the Main Activity
                {
                    Intent intent = new Intent(ACTION_USB_PERMISSION_NOT_GRANTED);
                    arg0.sendBroadcast(intent);
                }
            } else if (arg1.getAction().equals(ACTION_USB_ATTACHED)) {
                if (!serialPortConnected)
                    findSerialPortDevice(); // A USB device has been attached. Try to open it as a Serial port
            } else if (arg1.getAction().equals(ACTION_USB_DETACHED)) {
                // Usb device was disconnected. send an intent to the Main Activity
                Intent intent = new Intent(ACTION_USB_DISCONNECTED);
                arg0.sendBroadcast(intent);
                if (serialPortConnected) {
                    serialPort.close();
                }
                serialPortConnected = false;
            }
        }
    };

    /*
     * onCreate will be executed when service is started. It configures an IntentFilter to listen for
     * incoming Intents (USB ATTACHED, USB DETACHED...) and it tries to open a serial port.
     */
    @Override
    public void onCreate() {
        this.context = this;
        serialPortConnected = false;
        UsbService.SERVICE_CONNECTED = true;
        setFilter();
        usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
        findSerialPortDevice();
    }

    /* MUST READ about services
     * http://developer.android.com/guide/components/services.html
     * http://developer.android.com/guide/components/bound-services.html
     */
    @Override
    public IBinder onBind(Intent intent) {
        return binder;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return Service.START_NOT_STICKY;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        serialPort.close();
        unregisterReceiver(usbReceiver);
        UsbService.SERVICE_CONNECTED = false;
    }

    /*
     * This function will be called from MainActivity to write data through Serial Port
     */
    public void write(byte[] data) {
        if (serialPort != null)
        {
            serialPort.write(data);
        }
    }


    public void setHandler(Handler mHandler) {
        this.mHandler = mHandler;
    }

    private void findSerialPortDevice() {
        // This snippet will try to open the first encountered usb device connected, excluding usb root hubs
        HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
        if (!usbDevices.isEmpty()) {

            // first, dump the hashmap for diagnostic purposes
            for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
                device = entry.getValue();
                Log.d(TAG, String.format("USBDevice.HashMap (vid:pid) (%X:%X)-%b class:%X:%X name:%s",
                                         device.getVendorId(), device.getProductId(),
                                         UsbSerialDevice.isSupported(device),
                                         device.getDeviceClass(), device.getDeviceSubclass(),
                                         device.getDeviceName()));
            }

            for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
                device = entry.getValue();
                int deviceVID = device.getVendorId();
                int devicePID = device.getProductId();

//                if (deviceVID != 0x1d6b && (devicePID != 0x0001 && devicePID != 0x0002 && devicePID != 0x0003) && deviceVID != 0x5c6 && devicePID != 0x904c) {
                if (UsbSerialDevice.isSupported(device)) {
                    // There is a supported device connected - request permission to access it.
                    requestUserPermission();
                    break;
                } else {
                    connection = null;
                    device = null;
                }
            }
            if (device==null) {
                // There are no USB devices connected (but usb host were listed). Send an intent to MainActivity.
                Intent intent = new Intent(ACTION_NO_USB);
                sendBroadcast(intent);
            }
        } else {
            Log.d(TAG, "findSerialPortDevice() usbManager returned empty device list." );
            // There is no USB devices connected. Send an intent to MainActivity
            Intent intent = new Intent(ACTION_NO_USB);
            sendBroadcast(intent);
        }
    }

    private void setFilter() {
        IntentFilter filter = new IntentFilter();
        filter.addAction(ACTION_USB_PERMISSION);
        filter.addAction(ACTION_USB_DETACHED);
        filter.addAction(ACTION_USB_ATTACHED);
        registerReceiver(usbReceiver, filter);
    }

    /*
     * Request user permission. The response will be received in the BroadcastReceiver
     */
    private void requestUserPermission() {
        Log.d(TAG, String.format("requestUserPermission(%X:%X)", device.getVendorId(), device.getProductId() ) );
        PendingIntent mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
        usbManager.requestPermission(device, mPendingIntent);
    }

    public class UsbBinder extends Binder {
        public UsbService getService() {
            return UsbService.this;
        }
    }

    /*
     * A simple thread to open a serial port.
     * Although it should be a fast operation. moving usb operations away from UI thread is a good thing.
     */
    private class ConnectionThread extends Thread {
        @Override
        public void run() {
            serialPort = UsbSerialDevice.createUsbSerialDevice(device, connection);
            if (serialPort != null) {
                if (serialPort.open()) {
                    serialPortConnected = true;
                    serialPort.setBaudRate(BAUD_RATE);
                    serialPort.setDataBits(UsbSerialInterface.DATA_BITS_8);
                    serialPort.setStopBits(UsbSerialInterface.STOP_BITS_1);
                    serialPort.setParity(UsbSerialInterface.PARITY_NONE);
                    /**
                     * Current flow control Options:
                     * UsbSerialInterface.FLOW_CONTROL_OFF
                     * UsbSerialInterface.FLOW_CONTROL_RTS_CTS only for CP2102 and FT232
                     * UsbSerialInterface.FLOW_CONTROL_DSR_DTR only for CP2102 and FT232
                     */
                    serialPort.setFlowControl(UsbSerialInterface.FLOW_CONTROL_OFF);
                    serialPort.read(mCallback);
                    serialPort.getCTS(ctsCallback);
                    serialPort.getDSR(dsrCallback);

                    //
                    // Some Arduinos would need some sleep because firmware wait some time to know whether a new sketch is going
                    // to be uploaded or not
                    //Thread.sleep(2000); // sleep some. YMMV with different chips.

                    // Everything went as expected. Send an intent to MainActivity
                    Intent intent = new Intent(ACTION_USB_READY);
                    context.sendBroadcast(intent);
                } else {
                    // Serial port could not be opened, maybe an I/O error or if CDC driver was chosen, it does not really fit
                    // Send an Intent to Main Activity
                    if (serialPort instanceof CDCSerialDevice) {
                        Intent intent = new Intent(ACTION_CDC_DRIVER_NOT_WORKING);
                        context.sendBroadcast(intent);
                    } else {
                        Intent intent = new Intent(ACTION_USB_DEVICE_NOT_WORKING);
                        context.sendBroadcast(intent);
                    }
                }
            } else {
                // No driver for given device, even generic CDC driver could not be loaded
                Intent intent = new Intent(ACTION_USB_NOT_SUPPORTED);
                context.sendBroadcast(intent);
            }
        }
    }
}

. When I attempt to pass the Object itself I do the following.

Code:
private UsbService usbService;
...
Button swchBtn = (Button) findViewById(R.id.buttonSwitch);
        swchBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick (View v)
            {

                if(usbService != null)
                {
                    Intent swIntent = new Intent(MainActivity.this, SecondActivity.class);
                    swIntent.putExtra("USBService", usbService);
                    startActivity(swIntent);
                }
            }

before I switch activities I have done a quick check to make sure that it wasn't equal to "null". I'll change it up later and say if it is equal to null then I'll jump over but I won't send a intent extra. But for now it just crashes every time.

Any insight?

Michael

Send UDP from Application

Hello ,
I'm new at android\java so be patient :)

I want to create a small application that send a udp string to my server when I press the button.
everything is working - but it doesn't seem to send
this is what I have

btnAction.setOnClickListener(new View.OnClickListener() {
@ override
public void onClick(View v) {

try {

String messageStr = "test!";
int server_port = 1111;
DatagramSocket s = new DatagramSocket();
InetAddress local = InetAddress.getByName("My.Public.Server.IP");
int msg_length = messageStr.length();
byte[] message = messageStr.getBytes();
DatagramPacket p = new DatagramPacket(message, msg_length, local,server_port);
s.send(p);
}
catch (Exception e) {

}



}
}

whant could be the reason for it?

Thanks ,

Help Getting google calendar to see hotmail calendar on 10+

That's possible: I would never have considered configuring on a PC as I don't use Outlook on a computer. Back when I last had Outlook installed on my phone there was no such option (believe me, I looked!), but that was a couple of years ago.

(My MS account primarily exists as a backup: I've had Google's subscriptions to shared (non-Google) calendars fall over a few times over the years, so like to have an alternative I can switch to by just toggling visibilities. Plus I refuse to be dependent on any individual company, so for anything important I always have alternatives in place).

Help Transferring files to and from Acer Iconia7 tablet

Hi again, if somebody is out there :rolleyes:,
Earlier I said I can access the file directory in the tablet by way of Storage/Apps/Running/File Manager/LAUNCH/usbotg-sda1/

Now, today, the File Manager step is no longer offered in this series. How can this change? But I have discovered it in the main Apps menu and I am working on discovering how to download files from the USB-OTG drive to the tablet.
This is not yet clear to me: can someone please help?

Filter

Back
Top Bottom