support.v4.ListFragment shows data in Android 3.0 but not in 2.3.3

insane.bot

Why does the simple code below work in Android 3.0, but not in 2.3.3 ???
In 2.3.3, it shows only a blank screen.

There is no message in LogCat.
Any help would be appreciated.

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.widget.ArrayAdapter;

public class TestListFragment extends ListFragment {

    private ArrayAdapter<String> myAdapter;

    private String[] data = {"One", "Two", "Three"};

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        myAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, data);

        setListAdapter(myAdapter);
    }
}

Regards,

** EDIT

I found the cause. If the activity extends FragmentActivity, the code above works in 2.3.3, but if it extends ActionBarActivity it does not work.

Does someone know how to solve it ?

wangqi060934

I think the workaround is jus not use the default android.R.id.content to show the fragment.
I just do this:
In the onCreate() of your activity(extends ActionBarActivity):

setContentView(R.layout.whocares); getSupportFragmentManager().beginTransaction().add(R.id.the_root_view,yourFragment).commit();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Frankfurt S3 Fineuploader authorization,V4 support?

From Dev

d3 v4 update/merge grouped data

From Dev

d3 v4: Using stack with histogram data?

From Dev

D3 v4 Scaling Data to Range

From Dev

Create the sequence 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4 with seq()

From Dev

Import 3 SDKs, get error: Found 3 versions of android-support-v4.jar

From Dev

Typings Error when using D3 V4 on Angular 2 and Typescript V2

From Dev

How to add android.support.v4.app.ListFragment to activity?

From Dev

webApi2 Odata v3 and V4 side by side

From Dev

Generating an AWS Signature v4 signature for uploading to s3 (migration from v2)

From Dev

Why 2 ^ 3 ^ 4 = 0 in Julia?

From Dev

Does Android Webview support Spdy V3?

From Dev

How to make xscales and xaxis from this data D3 V4

From Dev

d3js v4 can't remove old data chart after update

From Dev

D3 v4 graph not updating bars - but appending new axis data

From Dev

d3 v4 tooltip passing data d issue

From Dev

d3 v4 getting data for bar graph tooltip

From Dev

python convert list [0, 1, 2, 3, 4, 5] to [0, 1, 2], [1,2,3], [2,3,4]

From Dev

Exporting non-S3-methods with dots in the name using roxygen2 v4

From Dev

What is the difference between [0,1,2,3,4] and [[0],[1],[2],[3],[4]]?

From Dev

ServiceStack V3 vs V4

From Dev

vim - configure for python3 support but still shows -python3 in version information

From Dev

DOM Level 2 and 3 Core support in IE?

From Dev

Listview shows 4 records. DataGridView shows 3 records?

From Dev

Cannot use attr with an object in D3 v4

From Dev

Bootstrap 3 DateTimePicker v4 Disable Month

From Dev

D3 V4 setting initial zoom level

From Dev

Rebinding exports in d3.js v4

From Dev

Behaviors are not supported in d3 v4

Related Related

  1. 1

    Frankfurt S3 Fineuploader authorization,V4 support?

  2. 2

    d3 v4 update/merge grouped data

  3. 3

    d3 v4: Using stack with histogram data?

  4. 4

    D3 v4 Scaling Data to Range

  5. 5

    Create the sequence 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4 with seq()

  6. 6

    Import 3 SDKs, get error: Found 3 versions of android-support-v4.jar

  7. 7

    Typings Error when using D3 V4 on Angular 2 and Typescript V2

  8. 8

    How to add android.support.v4.app.ListFragment to activity?

  9. 9

    webApi2 Odata v3 and V4 side by side

  10. 10

    Generating an AWS Signature v4 signature for uploading to s3 (migration from v2)

  11. 11

    Why 2 ^ 3 ^ 4 = 0 in Julia?

  12. 12

    Does Android Webview support Spdy V3?

  13. 13

    How to make xscales and xaxis from this data D3 V4

  14. 14

    d3js v4 can't remove old data chart after update

  15. 15

    D3 v4 graph not updating bars - but appending new axis data

  16. 16

    d3 v4 tooltip passing data d issue

  17. 17

    d3 v4 getting data for bar graph tooltip

  18. 18

    python convert list [0, 1, 2, 3, 4, 5] to [0, 1, 2], [1,2,3], [2,3,4]

  19. 19

    Exporting non-S3-methods with dots in the name using roxygen2 v4

  20. 20

    What is the difference between [0,1,2,3,4] and [[0],[1],[2],[3],[4]]?

  21. 21

    ServiceStack V3 vs V4

  22. 22

    vim - configure for python3 support but still shows -python3 in version information

  23. 23

    DOM Level 2 and 3 Core support in IE?

  24. 24

    Listview shows 4 records. DataGridView shows 3 records?

  25. 25

    Cannot use attr with an object in D3 v4

  26. 26

    Bootstrap 3 DateTimePicker v4 Disable Month

  27. 27

    D3 V4 setting initial zoom level

  28. 28

    Rebinding exports in d3.js v4

  29. 29

    Behaviors are not supported in d3 v4

HotTag

Archive