Finance for Android - A Google Dev eloper鈥檚 Note

by Bob Rose » Thu, 05 Mar 2009 22:59:41 GMT


Sponsored Links
 I wrote up my experiences working on the new Finance app here:

 http://www.googleandblog.com/finance-for-android-google-developers-note/3827/ 

enjoy!
Bob
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Emulator sdcard status - Environment.getExternalStorageState() = "removed"; file.canRead() = false

In java code, how do I mount the sdcard explicitly? How do I set the
readability of file to true?

Thanks.

-- 

2. Width of LayoutParams for the outer ViewGroup ignored when set in java code (instead of xml layout)

I created a very simple activity where I create and set the views in 
java code instead of xml. The width I pass to the outer LinearLayout 
though has no effect at all (200px). The view is displayed across the 
entire width of the screen, no matter what value I pass here.
(Note that this is just sample code; I know that in a real app you don't 
use fixed values nor px as unit. I just want to point out the issue I 
found for easier clarification).


But if I use the xml layout instead where the outer LinearLayout has a value of 200px, it's applied properly and the view only takes 200px of the screen. Why does setting a fixed width in java code for the outer layout has no effect, as opposed to the width set in xml? In the activity code below, un/commenting either one of the lines: // setContentView(llOuter); // <-- using views from xml setContentView(com.example.R.layout.main); // <-- using views from code above should result in the same layout, not? Activity: ========= public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // outer linear layout LinearLayout llOuter = new LinearLayout(this); llOuter.setLayoutParams(new LinearLayout.LayoutParams( 200, // *** this param has no effect *** LinearLayout.LayoutParams.FILL_PARENT )); llOuter.setBackgroundColor(Color.parseColor("#00ff00")); // inner linear layout LinearLayout llInner = new LinearLayout(this); llInner.setLayoutParams(new LinearLayout.LayoutParams( 100, // *** this param is applied correctly *** LinearLayout.LayoutParams.FILL_PARENT )); llInner.setBackgroundColor(Color.parseColor("#0000ff")); llOuter.addView(llInner); // setContentView(llOuter); // <-- using views from xml setContentView(com.example.R.layout.main); // <-- using views from code above } } main.xml ========= <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/llOuter" android:tag="asdd" android:layout_width="200px" android:layout_height="fill_parent" android:background="#00ff00" <LinearLayout android:id="@+id/llInner" android:layout_width="100px" android:layout_height="fill_parent" android:background="#0000ff" /> </LinearLayout> --

3. Efficient Drag and drop / image scaling? (and more drag and drop questions)

4. Reenacting the button actions

5. why sometimes LVL service doesn't work?

6. running emulator in non gui mode

7. arowboat / TI Android FroYo DevKit V2 Released