calling value from Arraylist in class from another one
<p>this code should do the next:</p>

<ol>
<li>parse data from <code>url1</code> webservice. </li>
<li>save the data into getter/setter in <code>ArrayList</code> defined in <code>DATA</code> class by this way: <code>public static final ArrayList&lt;ServiceEntity&gt; servicesE=new ArrayList&lt;ServiceEntity&gt;();</code></li>
<li>use the values in the <code>serviceE</code> in the class <code>HOME</code>. </li>
</ol>

<p>the problem is when call the value in the <code>serviceE</code> like this: <code>Data.serviceE.get(1).toString();</code> the app crashes.. and as :<code>s.getserviceE();</code> also crash the app....i don't know where is the problem and how to solve it.</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.babo);



       tv=(TextView) findViewById(R.id.textView1);

        try{
        url=url1;
        factory=XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(false);
        xpp=factory.newPullParser();
        xpp.setInput(getInputStream(srv), "UTF_8");
        insideItem = false;
        int eventType = xpp.getEventType();
        while (eventType != XmlPullParser.END_DOCUMENT) {

            if (eventType == XmlPullParser.START_TAG) {


                if (xpp.getName().equalsIgnoreCase(tag)) {

                    insideItem = true;

                } else if (xpp.getName().equalsIgnoreCase(SId)) {

                    if (insideItem){
                        serviceObj.setServiceId(responseTag);
                       //ID.add(xpp.nextText()); //extract the headline

                } else if (xpp.getName().equalsIgnoreCase(SEn)) {

                    if (insideItem)
                    {
                        serviceObj.setServiceE(xpp.nextText());
                        // link[x]=xpp.nextText();
                       // Enable.add(xpp.nextText()); //extract the link of article
                        //Data.sr.add(xpp.nextText());
                }
            }else if(eventType==XmlPullParser.END_TAG &amp;&amp; xpp.getName().equalsIgnoreCase(tag)){

                insideItem=false;

            }

            eventType = xpp.next(); //move to next element

        } 
            }
        }


        }catch(IOException e){
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        //tv.setText(Enable.get(1));
        Data.servicesE.add(serviceObj);

        }


    private InputStream getInputStream(URL srv2) {
        // TODO Auto-generated method stub
        try {
             return srv.openConnection().getInputStream();
             } catch (IOException e) {
        return null;
             }
    }



}
</code></pre>

<h2>serviceEntity:</h2>

<pre><code>public class servicesEntity  {

    private String servicesId;
    private String serviceE;    
    private String Service;

public void setService(String Service){
        this.Service= Service;
    }
public String getService() {
        return Service;
    }

public void setServiceId(String servicesId){
    this.servicesId= servicesId;
}
public String getservicesId() {
    return servicesId;
}
public String getServiceE() {
    return serviceE;
}
public void setServiceE(String serviceE) {
    this.serviceE = serviceE;
}

}
</code></pre>

<h2>home:</h2>

<pre><code>@Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.person);

     personalEC=(Carousel) findViewById(R.id.caro);

        mContext = this;

        //StudentDetailEntity student = Data.getStudentDetailsObject;
        semester = Data.getSemesterObject;
        performBottomBarButtonFunction() ;

         personalEC.setOnItemClickListener(new OnItemClickListener(){

            public void onItemClick(CarouselAdapter&lt;?&gt; parent, View view,
                    int position, long id) {
                // TODO Auto-generated method stub
               //   baka bk=new baka();


                if(position==0){

        Toast.makeText(mContext,s.getServiceE(), Toast.LENGTH_LONG);

                    }else if(position==1){
            Toast.makeText(mContext,"system", Toast.LENGTH_LONG);


                    }
}
</code></pre>

<p>9-30 11:40:40.335: E/AndroidRuntime(659): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0
09-30 11:40:40.335: E/AndroidRuntime(659):  at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
09-30 11:40:40.335: E/AndroidRuntime(659):  at java.util.ArrayList.get(ArrayList.java:304)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.university.app.PersonalHome$1.onItemClick(PersonalHome.java:72)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.university.app.controls.CarouselAdapter.performItemClick(CarouselAdapter.java:261)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.university.app.controls.Carousel.onSingleTapUp(Carousel.java:964)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.GestureDetector.onTouchEvent(GestureDetector.java:568)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.university.app.controls.Carousel.onTouchEvent(Carousel.java:310)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.View.dispatchTouchEvent(View.java:5541)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.View.dispatchPointerEvent(View.java:5721)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.os.Looper.loop(Looper.java:137)
09-30 11:40:40.335: E/AndroidRuntime(659):  at android.app.ActivityThread.main(ActivityThread.java:4424)
09-30 11:40:40.335: E/AndroidRuntime(659):  at java.lang.reflect.Method.invokeNative(Native Method)
09-30 11:40:40.335: E/AndroidRuntime(659):  at java.lang.reflect.Method.invoke(Method.java:511)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-30 11:40:40.335: E/AndroidRuntime(659):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-30 11:40:40.335: E/AndroidRuntime(659):  at dalvik.system.NativeStart.main(Native Method)
09-30 11:54:08.745: E/AndroidRuntime(770): java.lang.NullPointerException
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.university.app.PersonalHome$1.onItemClick(PersonalHome.java:72)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.university.app.controls.CarouselAdapter.performItemClick(CarouselAdapter.java:261)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.university.app.controls.Carousel.onSingleTapUp(Carousel.java:964)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.GestureDetector.onTouchEvent(GestureDetector.java:568)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.university.app.controls.Carousel.onTouchEvent(Carousel.java:310)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.View.dispatchTouchEvent(View.java:5541)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1951)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1712)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1957)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1726)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1912)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1371)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.app.Activity.dispatchTouchEvent(Activity.java:2364)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1860)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.View.dispatchPointerEvent(View.java:5721)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2890)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.os.Looper.loop(Looper.java:137)
09-30 11:54:08.745: E/AndroidRuntime(770):  at android.app.ActivityThread.main(ActivityThread.java:4424)
09-30 11:54:08.745: E/AndroidRuntime(770):  at java.lang.reflect.Method.invokeNative(Native Method)
09-30 11:54:08.745: E/AndroidRuntime(770):  at java.lang.reflect.Method.invoke(Method.java:511)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-30 11:54:08.745: E/AndroidRuntime(770):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-30 11:54:08.745: E/AndroidRuntime(770):  at dalvik.system.NativeStart.main(Native Method)</p>

<blockquote>
  <p>enter code here</p>
</blockquote>
