Will it work if I setListViewAdapter dynamically?

by olko » Wed, 04 Mar 2009 16:40:08 GMT


Sponsored Links
 I am trying to change ListView adapter on the  fly like this (the
AdapterMain* extends BaseAdapter):

                                if(main_view) {
                                        setListAdapter(new 
AdapterMain(app_context));
                                }
                                else {
                                        setListAdapter(new 
AdapterMainDetails(app_context));
                                }

Should I do other things or this would be enough?
--~--~---------~--~----~------------~-------~--~----~



Will it work if I setListViewAdapter dynamically?

by olko » Sat, 07 Mar 2009 03:49:50 GMT


 > It will work :)

yes, it does :)






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


Sponsored Links


Other Threads

1. Understanding the BroadcastReceiver

Hello,

I have an application that uses an extended BroadcastReceiver class inside
the Activity. I have the extended BroadcastReceiver class as a member
variable of the Activity class. But it looks like the receiver references
keep changing between its construction and 'onReceive' method call. I would
like to understand this better. Here are some details.

public class MyEventReceiver extends BroadcastReceiver {

    public MyEventReceiver(BNDialogInterface dlg) {
        System.out.println("Receiver Object in constructor: "+this);
    }

    public void onReceive(Context context, Intent intent) {
        System.out.println("Receiver Object in onReceive: "+this);
    }

}

My Activity class:

public class Notepadv2 extends Activity {
    private MyEventReceiver receiver;

    protected void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        receiver = new MyEventReceiver(this);

        Intent myIntent = new Intent("Test");
         sendBroadcast(myIntent);
    }


}

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.demo.notepad2">
    <application android:icon="@drawable/icon">

      <receiver android:name=".MyEventReceiver" android:enabled="true"
android:exported="true">
            <intent-filter>
               <action android:name="Test" />
            </intent-filter>
    </receiver>

        <activity android:name=".Notepadv2"
android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

<activity android:name=".NoteEdit"></activity>
</application>
</manifest>

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

2. get version from apk

Hi, can I get version from .apk file. I tried to open
androidmanifest.xml but I realized that xml files are destructed when
apk created.
--~--~---------~--~----~------------~-------~--~----~

3. Taking Control of Default UI

4. Multitouch support in Donut?

5. Multitouch API for the Hero ??

6. can andriod be in pda area?

7. 'm trying to align a button to the bottom of the frame