I'm trying to call an activity class from one segment. I have implemented the OnClickListener and this is also the method.
if (v.getId () == sortbutton.getId ()) {// callSorting (); Intent = intent (getActivity (), EMB_SortList.class); // startActivityForResult (intent, REQUEST_CODE_LEVEL); StartActivity; }
Here is my java file:
Public class ListViewFragment extends the fragment fragmented OnClickListener {@Override Public View onCreateView (LayoutInflater Inflator, ViewGroup Container, Bundle SavedInstanceState) {If (rootView! = Null) {ViewGroup parent = (ViewGroup) rootView.getParent (); If (parent! = Null) parent.removeView (Routeview); } Try {RootView = inflater.inflate (R.layout.list, Container, False); } Catch (InflateException e) {} sortbutton = (TextView) rootView.findViewById (R.id.sortText); Sortbutton.setOnClickListener (this); Return root view; } @ Override Crate on Public Zero (Bundle Saved Instantstate) {Super.Nought (Saved Instantstate); }
But I'm getting a strange error
03-16 19:40: 20.620: E / Android Random (1346): Quite Exception: Main 03-16 19: 40: 20.620: E / Android Random (1346): Android. SuperNotCalledException: Activity {com.ylg.Link/com.ylg.Link.SortList} did not call via super.onCreate () 03-16 19:40: 20.620: E / AndroidRuntime (1346): android.app.ActivityThread On .performLaunchActivity (ActivityThread.java June259) 03-16 19:40: 20.620: E / AndroidRuntime (1346): android.app.ActivityThread.handleLaunchActivity (ActivityThread.java jun349) on 03-16 19:40: 20.620: E / AndroidRuntime (1346): 40 :: 20.620: E / AndroidRuntime (1346): android.app.ActivityThread.access $ 700 (ActivityThread.java:159) on 03-16 19 android.app.ActivityThread $ H.handleMessage (ActivityThread .java: 1316) 03-16 19: 40: 20.620: E / Android Time (1346): Android.OS. Handler Dispose Message (Handler. Java: 99) 03-16-19: 40: 20.620: E / Android Time (1346): Android.OS Looper Oops (Looper.java:176) 03-16 19: 40: 20.620: E / Android Time (1346): yThread.main (ActivityThread.java:5419) on Android.app.activate 03-16 19:40: 20.620: E / AndroidRuntime (1346): java.lang.reflect.Method.invokeNative (Native Method) on 03-16 19: 40: 20.620: E / AndroidRuntime (1346): at java.lang.reflect.Method.invoke (method. Java 2525) 03-16 19:40: 20.620: E / Android time (1346): MethodandArgsCaller.run at com.android.internal.os.zygoteInit $ (ZygoteInit.java:1046) 03-16 19:40: 20.620: E / AndroidRuntime (1346): com.android.internal.os.ZygoteInit.main (ZygoteInit.java:862) on 03-16 19:40: 20.620: E / Android Random (1346): Dalvik.system.NativeStart.main (Basic method)
I'm not sure that What's wrong? Can somebody help me out?
Thank you!
It is clear that this class
EMB_SortList.class
You have to quench it by checking
@ override crate on public null (bundle saved instanestate) {super.naught (savedinstenstate); }
In fact, you need to change it with one of our answers and make sure that you are expanding the activity.
---------- -----------> God thinks that you put this code in your pieces.
Override public null on @Create (bundle saved instenstate) {super.onCreate (SavedInstanceState); }
If you needed to remove it
This code does not go into your piece, it goes into the activity that you want to create.
No comments:
Post a Comment