title: displaying image with name in android
body: <p>Hi Here I am going to displaying image with text.for that this is my code.If i run this application it showing log cat errors.</p>
  
  <p>for eg:a.jpeg with name a like this i want.</p>
  
  <p>But it's giving unfortunately error.</p>
  
  <p>can anyone please help me</p>
  
  <p><strong>Photos class</strong></p>
  
  <pre><code>public class Photos extends Activity {
  
      Button button1;  
      String mImages;
  
        public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.photos);
  
          ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
          ImagePagerAdapter adapter = new ImagePagerAdapter();
          viewPager.setAdapter(adapter);
        }
  
        private class ImagePagerAdapter extends PagerAdapter {
         private int[] mImages = new int[] {        
              R.drawable.a,
              R.drawable.b,
              R.drawable.c,
              R.drawable.d  
          };
            String[] description_images = getIntent().getExtras().getStringArray("[{image1,image2,image3,image4}]"); //ARRAY OF ALL TEXT ASSOCIATED TO IMAGES
           // String[] mImages1 = getIntent().getExtras().getStringArray("mImages");  
  
  
         // String[] mText={"Text1","Text2","Text3"};
  
          @Override
          public int getCount() {
            return mImages.length;
          }
  
          @Override
          public boolean isViewFromObject(View view, Object object) {
            return view == ((ImageView) object);
          }
  
          @Override
          public View instantiateItem(ViewGroup container, int position) {
              LayoutInflater inflater = LayoutInflater.from(container.getContext());
              View view = inflater.inflate(R.layout.image_view, null);
              final ImageView imageView = (ImageView)view.findViewById(R.id.iv_image);
              final TextView textView = (TextView )view.findViewById(R.id.iv_text);
  
              textView.setText(description_images[position]);
             imageView.setImageResource(mImages[position]);
              container.addView(view, 0);
              return view;
          }
  
          @Override
          public void destroyItem(ViewGroup container, int position, Object object) {
              container.removeView((View) object);
          }
      }
  }
  </code></pre>
  
  <p><strong>logcat error</strong></p>
  
  <pre><code>07-17 16:37:11.391: E/AndroidRuntime(562): FATAL EXCEPTION: main
  07-17 16:37:11.391: E/AndroidRuntime(562): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.imagegallery/com.example.imagegallery.Photos}: java.lang.NullPointerException
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.os.Handler.dispatchMessage(Handler.java:99)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.os.Looper.loop(Looper.java:123)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at java.lang.reflect.Method.invokeNative(Native Method)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at java.lang.reflect.Method.invoke(Method.java:521)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at dalvik.system.NativeStart.main(Native Method)
  07-17 16:37:11.391: E/AndroidRuntime(562): Caused by: java.lang.NullPointerException
  07-17 16:37:11.391: E/AndroidRuntime(562):  at com.example.imagegallery.Photos$ImagePagerAdapter.&lt;init&gt;(Photos.java:36)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at com.example.imagegallery.Photos$ImagePagerAdapter.&lt;init&gt;(Photos.java:29)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at com.example.imagegallery.Photos.onCreate(Photos.java:25)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  07-17 16:37:11.391: E/AndroidRuntime(562):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  07-17 16:37:11.391: E/AndroidRuntime(562):  ... 11 more
  </code></pre>