简体   繁体   中英

Java passing map to Methods (Android)

How to I change this...

((PlateDetailFragment) getSupportFragmentManager().findFragmentById(
            R.id.content_pane))
            .setText(DummyContent.ITEM_MAP.get(id).content);

and this...

public void setText(String text) {
    ((TextView) mRootView.findViewById(R.id.plate_detail)).setText(text);
    getActivity().getActionBar().setTitle("Action Bar");
}

So that I can access DummyContent.ITEM.id, DummyContent.ITEM.desc, DummyContent.ITEM.content (etc etc) from setText() ?

Am a total noob, thanks!

Edit: DummyContent is set and defined from the DummyContent.java inside the Android SDK except fields have been added to each item of information

You mean like this?

((PlateDetailFragment) getSupportFragmentManager().findFragmentById(
        R.id.content_pane))
        .setText(DummyContent.ITEM_MAP.get(id));


public void setText(DummyContent dummy) {
    ((TextView) mRootView.findViewById(R.id.plate_detail)).setText(dummy.content);
    getActivity().getActionBar().setTitle("Action Bar");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM