Getting text from Edittext
<p>I have downloaded a BLE sample and i want to edit the code. </p>

<p>I have added an Edittext in the code to send the numbers in it instead of the string "Praveen" from the original code, but my Galaxy S4 can't even open the app right now. The app works well without the changes.</p>

<p>Here are the changes i made for the code. The commented lines are from the original code, and the lines just below them are the changes i made. </p>

<p>Thanks in advance</p>

<pre><code>public static EditText Oe;

//public static String dummyName = "Praveen";
  public static String str = Oe.getText().toString();

public void sendAlert(BluetoothDevice device) {
    Log.d(TAG, "sendAlert");
    byte[] value = null;
    byte cat = (byte) callCategory;
    byte cnt = (byte) dummyCount;

    try {
       // String s = dummyName;
        String s = str;
        value = s.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    byte[] attVal = new byte[value.length + 2];

    attVal[0] = cat;
    attVal[1] = cnt;
    for (int i = 0; i &lt; value.length; i++)
        attVal[i + 2] = value[i];

    mNewAlert.setValue(attVal);
    mBluetoothGattServer.notifyCharacteristicChanged(device, mNewAlert, false);

}
</code></pre>

<p>The xml for Edittext </p>

<pre><code> &lt;EditText
    android:id="@+id/Oe"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="10"
    android:text="@string/Oe"/&gt;
</code></pre>

<p>I have defined the Edittext in the OnCreate</p>

<pre><code>public void onCreate() {

    Log.d(TAG, "onCreate() called");
    if (mBtAdapter == null) {
        mBtAdapter = BluetoothAdapter.getDefaultAdapter();
        if (mBtAdapter == null) {
            Log.i(TAG, "adapter is null");
            return;
        }
    }

    if (mBluetoothGattServer == null) {
        Log.i(TAG, "mBluetoothGattServer::null");
        Log.i(TAG, "getting proxy::");
        BluetoothGattAdapter.getProfileProxy(this, mProfileServiceListener,      BluetoothGattAdapter.GATT_SERVER);
    }

    mSMSMMSObserver = new BluetoothSMSMMSContentObserver();
    mCallObserver = new CallContentObserver();
    getContentResolver().registerContentObserver(Uri.parse("content://mms-sms"), true, mSMSMMSObserver);
    getContentResolver().registerContentObserver(CallLog.Calls.CONTENT_URI, true, mCallObserver);

    Oe = (EditText)findViewById(R.id.Oe);
}
</code></pre>

<p>Mainactivity part </p>

<pre><code>public void onClick(View v) {
    switch (v.getId()) {
    case R.id.btn_select:
        if (!mBluetoothAdapter.isEnabled()) {
            Log.i(TAG, "onClick - BT not enabled yet");
            Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
            startActivityForResult(enableIntent, REQUEST_ENABLE_BT);

              case R.id.button_send_alert:
                Log.e("MainActivity", "Clicked");
                if (mService != null)
                    mService.sendAlert(mDevice);
</code></pre>
