How to display a group of pictures?

by yves...@gmail.com » Thu, 07 May 2009 10:06:06 GMT


Sponsored Links
 I want to pick only 5 pictures (there are more than 20 in the same
folder) to be displayed in a slideshow. I can use Intent.Action_View
and then use setDataAndType with one uri, and it worked. But how to
add 5 pictures into it?
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. EditText stops displaying characters as I'm typing?

Basically what happens is I will start typing on the keyboard (stock
and third party), and all of a sudden it stops showing characters I
type in the EditText, (sometimes) resets the caret to the beginning,
yet I know I'm still typing because the suggestions box shows the
characters as I type.  I've experienced the behavior on at least 5
different devices (running 2.2, 2.3) as well as the emulator (running
2.1) but can't seem to nail down a solution.

It is seemingly random; I'm not reading any error logs through DDMS
from the system, (the only thing I see being written :sometimes: is
WARN/IInputConnectionWrapper(991): endBatchEdit on inactive
InputConnection) so I'm a little baffled.

Here is what it looks like: http://i.stack.imgur.com/gsB49.png

Here is the XML layout of the EditText:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <ListView android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:transcriptMode="alwaysScroll"/>

        <EditText android:id="@+id/etMain"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:inputType="text|textAutoCorrect"
            android:imeOptions="actionSend">
                <requestFocus />
            </EditText>
    </LinearLayout>


And here is my code from the Activity:

        et = (EditText) findViewById(R.id.etMain);

        et.setOnEditorActionListener(new OnEditorActionListener() {
                @Override
                        public boolean onEditorAction(TextView v, int actionId, 
KeyEvent
event) {
                        if ((event != null && (event.getKeyCode() ==
KeyEvent.KEYCODE_ENTER)) || actionId == EditorInfo.IME_ACTION_SEND) {
                                        String sendText = 
v.getText().toString();

                                        if (sendText.length() > 0) {
                                                v.setText("");

                                                ....

                                                }
                                        }
                                        return true;
                                }

                                return false;
                        }
        });


Appreciate any insights...let me know if you need anything else...

Ben

-- 

2. adding style in xml breaks onClick events.

when i add the style attribute for the my relativeLayout below it
breaks the onClick events in my activity.

---

<style name="list_item_bl" parent="text_large_bl">
        <item name="android:paddingRight">4sp</item>
        <item name="android:paddingLeft">4sp</item>
        <item name="android:background">@drawable/list_item_bl</item>
        <item name="android:focusable">false</item>
        <item name="android:focusableInTouchMode">false</item>
        <item name="android:clickable">true</item>
</style>

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:orientation="vertical"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">

        <TextView android:id="@+id/TextView01"
                          android:layout_height="wrap_content"
                          android:text="blah blah blah... blah blah"
                          android:textStyle="normal|bold"
                          android:gravity="center_vertical|center_horizontal"
                          android:layout_width="fill_parent" />

        <ListView android:id="@android:id/list"
                          android:layout_height="wrap_content"
                          android:layout_width="fill_parent" />
        <TextView
                android:id="@+id/android:empty"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/nothing" />

 </LinearLayout>

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/list_item"
        style="?listItem" >

        <TextView
                android:id="@+id/item_entry"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="left" android:focusable="false"
android:focusableInTouchMode="false"/>
    <TextView
                android:id="@+id/category_entry"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/item_entry"
                android:gravity="right"
                android:paddingLeft="8sp" android:focusable="false"
android:focusableInTouchMode="false"/>
    <TextView
                android:id="@+id/date_completed"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:gravity="right"
                android:paddingLeft="4sp" android:focusable="false"
android:focusableInTouchMode="false"/>

</RelativeLayout>

----

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

         ....

        fillData();
        getListView().setOnCreateContextMenuListener(this);

    }

        private void fillData() {
                ArrayList<String> names = new ArrayList<String>();
                for (int i = 0; i < _options.length; i++) {
                        String item = (String) _options[i];
                        if (_selections[i]) names.add(item);
                }
                _taskCursor = _dbHelper.fetchTasksByName(names);
                startManagingCursor(_taskCursor);

                String[] from = new String[] { TaskDbAdapter.KEY_ITEM,
TaskDbAdapter.KEY_CATEGORY, TaskDbAdapter.KEY_DATE };
                int[] to = new int[] { R.id.category_entry, R.id.item_entry,
R.id.date_completed };

                ListAdapter notesAdapter = new ListAdapter(this, 
R.layout.list_item,
_taskCursor, from, to);
                //SimpleCursorAdapter notesAdapter = new 
SimpleCursorAdapter(this,
R.layout.list_item, taskCursor, from, to)
                notesAdapter.setViewBinder(new ViewBinder() {
                                public boolean setViewValue(View aView, Cursor 
aCursor, int
aColumnIndex) {
                                        if (aColumnIndex == 3) {
                                                Date createDate = new 
Date(aCursor.getLong(aColumnIndex));
                                                TextView textView = (TextView) 
aView;
                                                
textView.setText(listFormat.format(createDate));
                                                return true;
                                        }
                                        return false;
                                }
                });

                setListAdapter(notesAdapter);
        }




---

i wrote a custom ListAdapter to see that would solve my problem.  i
can catch the listOnClick this way (with a lot of extra work) but
onCreateContextMenu never seems to get invoked.

this seems really weird that applying a style would break event
handling...

-- 

3. Tanya harga Archos 7" IT 8Gb

4. OOT: Paging pengguna paket data smartfren

5. About removing all android apps

6. simultaneous download of files - best way to handle it

7. Broadcast receiver not working in Activity