Wie man rootview in fragment?

Ich bin mit dieser Bibliothek für die Verwendung von ein emoji-Tastatur auf meinem app.
https://github.com/ankushsachdeva/emojicon

In der Readme besagt, dass die oberste Ansicht Ihrer Tätigkeit layout-Hierarchie werden verwendet, um zu initialisieren, "popupwindow".

Meine app erfolgt über Fragmente.

Dies ist der code, den ich verwende zum testen:

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.overview1_layout, container,
            false);

    //Give the topmost view of your activity layout hierarchy. This will be used to measure soft keyboard height
    EmojiconsPopup popup = new EmojiconsPopup(view, getActivity());

    //Will automatically set size according to the soft keyboard size        
    popup.setSizeForSoftKeyboard();

    popup.showAtBottom();


    return view;
}

Wenn ich diesen code ausführen, erhalte ich folgende Fehlermeldung in der logcat:

11-02 22:37:16.685: E/AndroidRuntime(30363): java.lang.RuntimeException: Unable to resume activity {com.Testing.full/com.Testing.full.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?

EDIT: ich bin mit SherlockFragment

getActivity().getWindow().getDecorView().getRootView();

InformationsquelleAutor tobias | 2014-11-02

Schreibe einen Kommentar