मैं निम्न त्रुटि है, जो मुझे समझ नहीं आता हो रही है साथ ClassNotFoundException ...एंड्रॉयड ViewPager
06-15 22:06:49.196: W/dalvikvm(17622): threadid=1: thread exiting with uncaught exception (group=0x40bcc1f8)
06-15 22:07:05.031: W/dalvikvm(17877): threadid=1: thread exiting with uncaught exception (group=0x40bcc1f8)
06-15 22:07:05.031: E/AndroidRuntime(17877): FATAL EXCEPTION: main
06-15 22:07:05.031: E/AndroidRuntime(17877): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whipple.android/com.whipple.android.StockActivity}: android.view.InflateException: Binary XML file line #6: Error inflating class ViewPager
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1968)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.ActivityThread.access$600(ActivityThread.java:127)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.os.Handler.dispatchMessage(Handler.java:99)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.os.Looper.loop(Looper.java:137)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.ActivityThread.main(ActivityThread.java:4512)
06-15 22:07:05.031: E/AndroidRuntime(17877): at java.lang.reflect.Method.invokeNative(Native Method)
06-15 22:07:05.031: E/AndroidRuntime(17877): at java.lang.reflect.Method.invoke(Method.java:511)
06-15 22:07:05.031: E/AndroidRuntime(17877): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
06-15 22:07:05.031: E/AndroidRuntime(17877): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
06-15 22:07:05.031: E/AndroidRuntime(17877): at dalvik.system.NativeStart.main(Native Method)
06-15 22:07:05.031: E/AndroidRuntime(17877): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class ViewPager
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-15 22:07:05.031: E/AndroidRuntime(17877): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:272)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.Activity.setContentView(Activity.java:1851)
06-15 22:07:05.031: E/AndroidRuntime(17877): at com.whipple.android.StockActivity.onCreate(StockActivity.java:17)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.Activity.performCreate(Activity.java:4481)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
06-15 22:07:05.031: E/AndroidRuntime(17877): ... 11 more
06-15 22:07:05.031: E/AndroidRuntime(17877): Caused by: java.lang.ClassNotFoundException: android.view.ViewPager
06-15 22:07:05.031: E/AndroidRuntime(17877): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-15 22:07:05.031: E/AndroidRuntime(17877): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-15 22:07:05.031: E/AndroidRuntime(17877): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:636)
06-15 22:07:05.031: E/AndroidRuntime(17877): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
06-15 22:07:05.031: E/AndroidRuntime(17877): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
06-15 22:07:05.031: E/AndroidRuntime(17877): ... 21 more
यह मेरा कोड है ...
public class StockActivity extends Activity {
public ListAdapter listadapter;
private StockPageAdapter myAdapter;
private ViewPager myPager;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.main);
this.myAdapter = new StockPageAdapter(this);
this.myPager = (ViewPager)super.findViewById(R.id.pager);
this.myPager.setAdapter(myAdapter);
}
यह एक ViewPager
के साथ एक ListAdapter
है सूचियों के माध्यम से स्क्रॉल करने के लिए। मैं BaseAdapter
का विस्तार कर रहा हूँ और इस कोड के साथ दृश्य बढ़ाकर ...
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.row, null);
किसी की मदद कृपया सकते हैं मुझे समझने की क्या गलत है।
हाँ पूरी तरह से इसके बारे में भूल गए। इसे बदल दिया और अब मैं अगली त्रुटि पर हूं। ._। धन्यवाद हालांकि –
यह वही समस्या तय करता है जो मैं कर रहा था, बहुत बहुत धन्यवाद! – Kyle
धन्यवाद, अच्छी तरह से किया! +1 –