How to get several SdCard devices names on Android ?

by Peter Jeffe » Tue, 25 May 2010 00:40:55 GMT


Sponsored Links
 



As it says, this call gets the FAT volume id for the given mount
point:

    public static native int getFatVolumeId(String mountPoint);

--



How to get several SdCard devices names on Android ?

by Peter Jeffe » Tue, 25 May 2010 01:38:13 GMT


 


Sorry, I realized I was bit terse here.  This isn't an exposed
interface, so it's unsupported, but it's the only way I know to get
it, so use at your own risk.  Create the following class:

package android.os;
public class FileUtils {
    public static native int getFatVolumeId(String mountPoint);
}

and put that in an android.os package in your app.  It's basically a
stub that lets you access the call at runtime.

--


Sponsored Links


Other Threads

1. ArrayList items are missing

At the moment, I have two Activities (Activity A and B). At the
Activity A I customize a button and pass it on Activity B via an
intent. On Activity B I move the button somewhere on the screen. This
will be done with other buttons. So I want to save some attributes of
a button like height, width and alignment.

I tried to save them in an ArrayList but everytime I access the
ArrayList after changing back from Activity B to Activity A to create
a second button, the ArrayList is empty.

How could I achieve the ArrayList isn't loosing it's items ?
I think the worst idea is, to make an Intent with that ArrayList
sending it to Activity A.The List is getting bigger and bigger and I
start to loose performance.

Any suggestion how this can be solved ?

I would be deeply grateful and thanks in advance !

--

2. TableLayout will not draw new row addition

I have  TableLayout defined in the main.xml. Simple, 1 header row and 1 data
row.
<TableLayout android:id="@+id/*reportsTable*"
                    android:layout_width="fill_parent"
android:layout_height="wrap_content">
                    <TableRow>
                        <TextView android:id="@+id/DateOfReport"
android:text="Report Date"
                            android:textSize="14px"
android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                        <TextView android:id="@+id/HeightHeading"
android:text="Height"
                            android:textSize="14px"
android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                        <TextView android:id="@+id/WeightHeading"
android:text="Weight"
                            android:textSize="14px"
android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                    </TableRow>
                    <TableRow android:id="@+id/r1"
android:layout_width="wrap_content"
                        android:layout_height="wrap_content">
                        <LinearLayout android:orientation="horizontal"
                            android:layout_width="fill_parent"
android:layout_height="wrap_content">
                            <EditText android:id="@+id/dateOfReport"
android:text="DD/MM/YYYY"
                                android:textSize="11px"
android:layout_width="wrap_content"
                                android:layout_height="wrap_content" />
                            <Button android:id="@+id/changeReportDate"
android:text="..."
                                android.textSize="12px"
android:layout_width="wrap_content"
                                android:layout_height="wrap_content" />
                        </LinearLayout>
                        <EditText android:id="@+id/height"
android:text="inCmOrInch"
                            android:textSize="11px"
android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                        <EditText android:id="@+id/weight"
android:text="inKgOrPound"
                            android:textSize="11px"
android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                    </TableRow>


Now in the code I have a function defined that adds a new row.


private TableRow createNewTableRow(TableRow newRow){
        newRow.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)) ;
        LinearLayout newLinearLayout = new LinearLayout(appActivity) ;
        newLinearLayout.setOrientation(LinearLayout.HORIZONTAL);
        newLinearLayout.setLayoutParams(new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)) ;
        EditText newReportDate = new EditText(appActivity) ;
        newReportDate.setTextSize((float) 11.0);
        newReportDate.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)) ;
        Button changeReportDate = new Button(appActivity) ;
        changeReportDate.setTextSize((float) 12.0);
        changeReportDate.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)) ;
        changeReportDate.setText("...");
        EditText newHeight = new EditText(appActivity) ;
        newHeight.setTextSize((float) 11.0);
        newHeight.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)) ;
        EditText newWeight = new EditText(appActivity) ;
        newWeight.setTextSize((float) 11.0);
        newWeight.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)) ;

        newRow.addView(newLinearLayout);
        newLinearLayout.addView(newReportDate);
        newLinearLayout.addView(changeReportDate);
        newRow.addView(newHeight);
        newRow.addView(newWeight);
        return newRow ;
    }



Now, in the main code I call this function

if (v == (View) *addReportWidget*) {
            TableRow newRow = new TableRow(appActivity, null);
            *reportsTableWidget*.addView(createNewTableRow(newRow));
            reportsTab.invalidate();
        }

Now, the new row just wont show up. If I run the code in the de{*filter*}, and
watch *reportsTableWidget*.mChildren, everytime I click on *addReportWidget*,
a new entry shows up in the de{*filter*} watch variables.

What am I missing. Very frustating, please advice me.

Regards
Siddharth

3. how to use style

4. setting tsel

5. Leak rumor: GMS

6. onKeyUp not getting called after EditText regains focus

7. OpenGL App crashes on Nexus One