fragment conversion error in Android -


myfragment frag = fragmanager.findfragmentbyid(r.layout.testing_res); 

testing_res layout hosting activity. it's spitting error @ me though

**required**: com.example.blahblah.blah.myfragment; **found** :android.app.fragment;

any suggestions why?

code fragment class

public class myfragment extends fragment {      @override     public void oncreate(bundle savedstate) {         super.oncreate(savedstate);     }       @override     public view oncreateview(layoutinflater i, viewgroup v, bundle state) {         return i.inflate(r.layout.my_fragment, v, false);     } } 

try changing following import

import android.app.fragment 

to

import android.support.v4.app.fragment 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -