Home > Mobile >  How to use in fragments xutil3
How to use in fragments xutil3

Time:12-03



Want to ask bosses, xutil3 x.E xt in fragments. The init (getApplication ()); What just is not an error, it should be changed

CodePudding user response:

Create a new class, inheritance Appliction, then create a onCreate method in inheriting the Appliction of,

CodePudding user response:

reference 1st floor jonical response:
create a new class, inheritance Appliction, then create a onCreate method in inheriting the Appliction of,

I want to use in fragments   , not in the activity,,,

CodePudding user response:

refer to the second floor sovereign small tao ya reply:
Quote: refer to 1st floor jonical response:
create a new class, inheritance Appliction, then create a onCreate method in inheriting the Appliction of,

I want to use in fragments   , not in the activity,,,
see clear, is not inherited activity, inherit the Appliction (is inherited APP, not inherited form)
 
Public class IntiXutils extends Application {
@ Override
Public void onCreate () {
Super. The onCreate ();
X.E xt. Init (this);
}
}

To use xUtils3 must first create a new class of input in the superclass Appliction inherited (APP), and then in onCreate initialization xUtils first, after the Mainfest. Application node in an XML file, input the android: name="XXXX (the new class name, automatically)",
Then you can use, whether in fragments in the activity,
Direct x.i mage (). The bind (ImageView view, String Url); (this is a picture binding)

CodePudding user response:

Thank you very much! Has been resolved
  • Related