GridView - setting selection to last item also loads first item

by Mark Murphy » Mon, 19 Jul 2010 22:54:36 GMT


Sponsored Links
 


setTag() is 1.0+. Indexed setTag() is 1.6+.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

--



Other Threads

1. SMS Inbox: 2008's toughest problem ( At least for me)

###################################################################
Please help me access the list of sms in the inbox. I am using this
code, please let me know what is wrong, it always gives a n unexpected
error popup in the emulator.


I used a similar code for accessing the contacts list ( People.NAME
etc ), it worked fine. However, I cannot do it for SMS inbox.

Thanks in advance and happy new year!
###################################################################
package org.anddev.android.hello;

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Telephony.Sms;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;

public class HelloAndroid extends ListActivity {

     private ListAdapter mAdapter;

      /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        Cursor c = getContentResolver().query(Sms.Inbox.CONTENT_URI,
null, null, null, null);//.query(Sms.CONTENT_URI, null, null, null,
null);
        startManagingCursor(c);
        String[] columns = new String[]{Sms.Inbox.READ};
        int[] names = new int[]{R.id.row_entry};
        mAdapter = new SimpleCursorAdapter(this, R.layout.main, c,
columns, names);

        this.setListAdapter(mAdapter);
    }

 }
###################################################################

Here is the main.xml code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Name: "
    />
<TextView
    android:id="@+id/row_entry"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</LinearLayout>

#####################################################################
--~--~---------~--~----~------------~-------~--~----~

2. Template for End User Licence Agreement

Is there a template for an End User Licence Agreement available anywhere?

 

Or any kind of a "standardized" method of showing it? 

 

Just checking before I write my own :-)

 

 

 

Sincerely,

 

Brad Gies

 

 

-----------------------------------------------------------------

Brad Gies

27415 Greenfield Rd, # 2,

Southfield, MI, USA

48076

www.bgies.com  www.truckerphone.com 

www.EDI-Easy.com  www.pricebunny.com

-----------------------------------------------------------------

 

Moderation in everything, including abstinence

 


--~--~---------~--~----~------------~-------~--~----~

3. using Music application

4. Sharing a MapView between two Activities

5. InstrumentationTestCase for UI integration testing

6. Error on dmtracedump

7. Problems with Radio Group