My question is split into a design question and a functional question. 
 Actual questions are in red:

*DESIGN PART OF THE QUESTION*

Im trying to modify an existing project, the BluetoothLeGatt example, to 
turn it into ArduDroid, which is this app used to interface with Arduino 
via BT.  The ArduDroid looks like this:

<https://lh3.googleusercontent.com/-Ey0-8ov5hEE/VwWjVeipYYI/AAAAAAAAD0U/VaLd1flEUV8rqYL39F9n8JBl6NCD6JHlw/s1600/ardudroid.png>

I was thinking of adding an outer table layout of 1 table and 3 rows:

1.  Main layout = a Table layout with 3 rows (in dark blue)

2.  First blue row: Linear layout with 2 red rows each with a seek and then 
a text.

3.  Second blue row: Relative layout with grid layout of 4x4 green

4.  Third blue row: Linear layout with 2 red rows each with a button and 
then a text.


<https://lh3.googleusercontent.com/-mQfSiD0_FLI/VwblGZZ9oOI/AAAAAAAAD1I/E23GfHEIYp8G8lUUWdQsMXums6ByeSbPA/s1600/image%2B%25281%2529.jpeg>

DESIGN QUESTION 1

So this is my xml so far, but for some reason I cant see the 2nd slider or 
seek component.  Could someone point out why?

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:stretchColumns="1"
    android:divider="#000000"
    android:dividerPadding="@dimen/margin_medium"
    android:showDividers="beginning"
    android:visibility="visible"
    android:background="#fac4c4">

    <!--begin my table-->
    <!--begin Row1 for sliders-->
    <TableRow android:background="#00ff00"
        android:layout_margin="2dip"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <!--begin Row1.row1 for Pin11-->

            <TableRow android:background="#00ff00"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <SeekBar
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/seekBar"
                    android:layout_column="0"/>

                <TextView
                    android:text="Pin 11"
                    android:gravity="center"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </TableRow>
            <!--begin Row1.row2 for Pin10-->

            <TableRow android:background="#00ff00"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <SeekBar
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/seekBar2"
                    android:layout_column="0"/>

                <TextView
                    android:text="Pin 10"
                    android:gravity="center"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </TableRow>
        </LinearLayout>
    </TableRow>

    <!--begin Row2 for buttons-->

    <TableRow android:background="#3676d8">
        <TextView
            android:text="C"
            android:padding="3dip" />
        <TextView
            android:text="D"
            android:gravity="right"
            android:padding="3dip" />
    </TableRow>

    <!--begin Row3 for textfields-->

    <TableRow android:background="#3676d8">
        <TextView
            android:text="E"
            android:padding="3dip" />
        <TextView
            android:text="F"
            android:gravity="right"
            android:padding="3dip" />
    </TableRow>
</TableLayout>



*FUNCTIONAL PART OF THE QUESTION*

Looking at the BluetoothLEGatt example I see this structure in the layout 
folder to see what the main view is so that i can add my table there but I 
dont understand it.  I have these 3 layout/*.xml files:

1.  actionbar_indeterminate_progress.xml
2.  gatt_services_characteristics.xml
3.  listitem_devices.xml

The actionbar is just a progress bar on the top left corner.  The 
gatt_services looks to be a popup of some sort and so does the listitem xml.

The project has 4 java files:

1. DeviceScanActivity.java which appears to be the default activity from 
the AndroidManifest.
2. DeviceControlActivity.java
3. BluetoothLEService.java which has the BT adapter and connection code
4. SampleGattAttributes.java which displays attributes of a given device.

<https://lh3.googleusercontent.com/-61Tp8-WBoLA/VwaYazVfrkI/AAAAAAAAD0w/mhZlvcbak7Q3zlVicxr_aQgeN_-JoMgsA/s1600/Screenshot%2B2016-04-07%2B11.18.26.png>


How do I add a new view such that it is presented after the device has been 
picked and connected to from the list so that I can drop my tableview 
layout in there?  What I have done so far is add this to my 
DeviceScanActivity's onCreate method (just the one line added april 7):

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActionBar().setTitle(R.string.title_devices);
    mHandler = new Handler();
    setContentView(R.layout.activity_main); //<<<<<<<<<<< added april 7

    if 
(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
        Toast.makeText(this, R.string.ble_not_supported, 
Toast.LENGTH_SHORT).show();
        finish();
    }

    final BluetoothManager bluetoothManager =
            (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
    mBluetoothAdapter = bluetoothManager.getAdapter();

    if (mBluetoothAdapter == null) {
        Toast.makeText(this, R.string.error_bluetooth_not_supported, 
Toast.LENGTH_SHORT).show();
        finish();
        return;
    }
}



-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/bc14be9b-29d6-4575-946a-121ffdaa6066%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to