Algorithm to implement a word cloud like Wordle

Context Take a look at Wordle: http://www.wordle.net/ It’s much better looking than any other word cloud generators I’ve seen Note: the source is not available – read the FAQ: http://www.wordle.net/faq#code My Questions Is there an algorithm available that does what Wordle does? If no, what are some alternatives that produces similar kinds of output? Why … Read more

Set the layout weight of a TextView programmatically

I’m trying to dynamically create TableRow objects and add them to a TableLayout. The TableRow objects has 2 items, a TextView and a CheckBox. The TextView items need to have their layout weight set to 1 to push the CheckBox items to the far right. I can’t find documentation on how to programmatically set the … Read more

What is “android.R.layout.simple_list_item_1”?

I’ve started learning Android development and am following a todolist example from a book: // Create the array list of to do items final ArrayList<String> todoItems = new ArrayList<String>(); // Create the array adapter to bind the array to the listView final ArrayAdapter<String> aa; aa = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, todoItems ); myListView.setAdapter(aa); I can’t … Read more

Set margins in a LinearLayout programmatically

I’m trying to use Java (not XML) to create a LinearLayout with buttons that fill the screen, and have margins. Here is code that works without margins: LinearLayout buttonsView = new LinearLayout(this); buttonsView.setOrientation(LinearLayout.VERTICAL); for (int r = 0; r < 6; ++r) { Button btn = new Button(this); btn.setText(“A”); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT); … Read more