Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- error log:
- 01-15 17:57:03.789: E/AndroidRuntime(31398): FATAL EXCEPTION: main
- 01-15 17:57:03.789: E/AndroidRuntime(31398): java.lang.NullPointerException
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at com.services.anki.Service_SingleItemView.use_Map(Service_SingleItemView.java:248)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at com.services.anki.Service_SingleItemView$ViewPagerAdapter.instantiateItem(Service_SingleItemView.java:178)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.support.v4.view.ViewPager.populate(ViewPager.java:987)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1196)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.ScrollView.onMeasure(ScrollView.java:318)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:762)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4816)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2152)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.View.measure(View.java:15193)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1850)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1102)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1275)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4221)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.Choreographer.doFrame(Choreographer.java:525)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.os.Handler.handleCallback(Handler.java:615)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.os.Handler.dispatchMessage(Handler.java:92)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.os.Looper.loop(Looper.java:137)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at android.app.ActivityThread.main(ActivityThread.java:4794)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at java.lang.reflect.Method.invokeNative(Native Method)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at java.lang.reflect.Method.invoke(Method.java:511)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
- 01-15 17:57:03.789: E/AndroidRuntime(31398): at dalvik.system.NativeStart.main(Native Method)
- 01-15 17:57:03.799: I/MemoryCache(31398): cache size=397428 length=8
- 01-15 17:57:05.079: E/Google Maps Android API(31398): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
- 01-15 17:57:05.089: E/Google Maps Android API(31398): In the Google Developer Console (https://console.developers.google.com)
- 01-15 17:57:05.089: E/Google Maps Android API(31398): Ensure that the "Google Maps Android API v2" is enabled.
- 01-15 17:57:05.089: E/Google Maps Android API(31398): Ensure that the following Android Key exists:
- 01-15 17:57:05.089: E/Google Maps Android API(31398): API Key: AIzaSyAQteoMwQHiSDG51pPyn--TJZyJjO_La_s
- 01-15 17:57:05.089: E/Google Maps Android API(31398): Android Application (<cert_fingerprint>;<package_name>): 66:38:68:53:86:C0:75:90:20:A4:2B:74:FF:BF:55:22:6C:15:93:3C;com.anki.ejigap
- Here is my Fragment class where i am using viewpager and all things:
- public class Service_SingleItemView extends Fragment {
- String heading, description, btnclickimage;
- ImageView img_service_banner_top, img_logo, img_service_icon,
- img_service_logo;
- ImageView img_termCond, img_share, img_eGift, img_Renew, img_Scan,
- map_icon;
- TextView txt_expireDate, clickdestxt, txt_serviceName,txt_nearest_outlet_name;
- ViewPagerAdapter adapter;
- ViewPager myPager;
- RelativeLayout layout_service_landing;
- GoogleMap map;
- ArrayList<HashMap<String, String>> data;
- HashMap<String, String> resultp = new HashMap<String, String>();
- ImageLoader_ServiceList dash_ImageLoader = new ImageLoader_ServiceList(
- getActivity());
- Layout_ImageLoader layout_ImageLoader = new Layout_ImageLoader(
- getActivity());
- private Intent intent;
- private Bundle bundle;
- public Service_SingleItemView() {
- }
- @SuppressWarnings("unchecked")
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.service_viewpager, container,
- false);
- int posi = getActivity().getIntent().getIntExtra("positionkey", 0);
- intent = getActivity().getIntent();
- bundle = intent.getBundleExtra("bundle");
- data = (ArrayList<HashMap<String, String>>) bundle
- .getSerializable("data");
- adapter = new ViewPagerAdapter(getActivity(), data);
- myPager = (ViewPager) rootView.findViewById(R.id.viewpager);
- myPager.setAdapter(adapter);
- adapter.notifyDataSetChanged();
- myPager.setCurrentItem(posi);
- return rootView;
- }
- public class ViewPagerAdapter extends PagerAdapter {
- int size;
- Context act;
- View layout;
- TextView txt;
- ArrayList<HashMap<String, String>> arraylist;
- public ViewPagerAdapter(Context act,
- ArrayList<HashMap<String, String>> arraylist) {
- this.act = act;
- this.arraylist = arraylist;
- }
- @Override
- public Object instantiateItem(ViewGroup container, int position) {
- LayoutInflater inflater = ((Activity) act).getLayoutInflater();
- View cont = inflater.inflate(R.layout.service_banner_details, null,
- true);
- use_Map();
- ((ViewPager) container).addView(cont, 0);
- return cont;
- }
- @Override
- public void destroyItem(View arg0, int arg1, Object arg2) {
- ((ViewPager) arg0).removeView((View) arg2);
- }
- @Override
- public boolean isViewFromObject(View arg0, Object arg1) {
- return arg0 == ((View) arg1);
- }
- @Override
- public Parcelable saveState() {
- return null;
- }
- @Override
- public int getCount() {
- return arraylist.size();
- }
- @Override
- public int getItemPosition(Object object) {
- return POSITION_NONE;
- }
- }
- public void use_Map() {
- LatLng HAMBURG = new LatLng(28.535516, 77.391026);
- LatLng KIEL = new LatLng(28.474388, 77.503990);
- map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map))
- .getMap();
- Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG)
- .title("Hamburg"));
- Marker kiel = map.addMarker(new MarkerOptions()
- .position(KIEL)
- .title("Kiel")
- .snippet("Kiel is cool")
- .icon(BitmapDescriptorFactory
- .fromResource(R.drawable.ic_pages)));
- // Move the camera instantly to hamburg with a zoom of 15.
- map.moveCamera(CameraUpdateFactory.newLatLngZoom(KIEL, 15));
- // Zoom in, animating the camera.
- map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
- }
- }
- here is the service_viewpager:
- <?xml version="1.0" encoding="utf-8"?>
- <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/scroll"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_marginTop="?android:attr/actionBarSize"
- android:fillViewport="true" >
- <RelativeLayout
- android:id="@+id/service_pager_layout"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
- <android.support.v4.view.ViewPager
- android:id="@+id/viewpager"
- android:layout_width="fill_parent"
- android:layout_height="1500dp" >
- </android.support.v4.view.ViewPager>
- </RelativeLayout>
- </ScrollView>
- here is the another layout where i am using google map, service_banner_details.xml :
- <?xml version="1.0" encoding="utf-8"?>
- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/layout_service_landing"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
- <ImageView
- android:id="@+id/img_service_banner_top"
- android:layout_width="match_parent"
- android:layout_height="350dp"
- android:contentDescription="@drawable/login_top_img" />
- <ImageView
- android:id="@+id/img_service_logo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@+id/img_service_banner_top"
- android:layout_marginTop="5dp"
- android:contentDescription="@drawable/login_top_img" />
- <LinearLayout
- android:id="@+id/layout_for_pName_icon"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/img_service_logo"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="30dp"
- android:orientation="horizontal" >
- <ImageView
- android:id="@+id/img_service_icon"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:contentDescription="@drawable/login_top_img" />
- <TextView
- android:id="@+id/txt_service_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingBottom="1dp"
- android:paddingTop="8dp"
- android:textColor="#796447"
- android:textSize="14sp"
- android:textStyle="italic" />
- </LinearLayout>
- <RelativeLayout
- android:id="@+id/layout_for_expireDate"
- android:layout_width="match_parent"
- android:layout_height="50dp"
- android:layout_below="@+id/layout_for_pName_icon"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="20dp"
- android:background="@color/txt_expire"
- android:gravity="center"
- android:orientation="horizontal" >
- <TextView
- android:id="@+id/txt_package"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:text="Body Treatment"
- android:textColor="#796447"
- android:textSize="13sp"
- android:textStyle="italic" />
- <TextView
- android:id="@+id/txt_expireDate"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:text="ExpireDate"
- android:textColor="#796447"
- android:textSize="12sp"
- android:textStyle="normal" />
- </RelativeLayout>
- <View
- android:id="@+id/txt_line_forBoarder"
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:layout_below="@+id/layout_for_expireDate"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:background="#B7B5B5" >
- </View>
- <LinearLayout
- android:id="@+id/layout_for_session"
- android:layout_width="match_parent"
- android:layout_height="300dp"
- android:layout_below="@+id/txt_line_forBoarder"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:background="@color/txt_expire"
- android:orientation="horizontal" >
- </LinearLayout>
- <RelativeLayout
- android:id="@+id/layout_for_buttons"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/layout_for_session"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="20dp"
- android:orientation="horizontal" >
- <ImageView
- android:id="@+id/img_termCond"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_alignParentLeft="true"
- android:layout_marginLeft="10dp" >
- </ImageView>
- <ImageView
- android:id="@+id/img_share"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_marginLeft="15dp"
- android:layout_toRightOf="@+id/img_termCond" >
- </ImageView>
- <ImageView
- android:id="@+id/img_eGift"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_centerHorizontal="true" >
- </ImageView>
- <ImageView
- android:id="@+id/img_Renew"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_marginLeft="15dp"
- android:layout_toRightOf="@+id/img_eGift" >
- </ImageView>
- <ImageView
- android:id="@+id/img_Scan"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_alignParentRight="true"
- android:layout_marginRight="10dp" >
- </ImageView>
- </RelativeLayout>
- <LinearLayout
- android:id="@+id/layout_for_mapIcon"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@+id/layout_for_buttons"
- android:layout_marginLeft="10dp"
- android:layout_marginRight="10dp"
- android:layout_marginTop="30dp"
- android:orientation="horizontal" >
- <ImageView
- android:id="@+id/map_icon"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:contentDescription="@drawable/login_top_img" />
- <TextView
- android:id="@+id/txt_nearest_outlet"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingBottom="1dp"
- android:paddingTop="8dp"
- android:text="NEAREST OUTLET"
- android:textColor="#796447"
- android:textSize="14sp"
- android:textStyle="italic" />
- </LinearLayout>
- <TextView
- android:id="@+id/txt_nearest_outlet_name"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@+id/layout_for_mapIcon"
- android:layout_marginLeft="15dp"
- android:layout_marginTop="10dp"
- android:textColor="#796447"
- android:textSize="14sp"
- android:textStyle="italic" />
- <HorizontalScrollView
- android:id="@+id/google_map"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@+id/txt_nearest_outlet_name"
- android:layout_marginLeft="20dp"
- android:layout_marginTop="15dp" >
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
- <fragment
- android:id="@+id/map"
- android:name="com.google.android.gms.maps.MapFragment"
- android:layout_width="250dp"
- android:layout_height="250dp" />
- <fragment
- android:id="@+id/location_map"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginLeft="20dp"
- android:name="com.google.android.gms.maps.MapFragment" />
- <fragment
- android:id="@+id/map1"
- android:name="com.google.android.gms.maps.MapFragment"
- android:layout_width="250dp"
- android:layout_height="250dp"
- android:layout_marginLeft="30dp" />
- <fragment
- android:id="@+id/map2"
- android:name="com.google.android.gms.maps.MapFragment"
- android:layout_width="250dp"
- android:layout_height="250dp"
- android:layout_marginLeft="30dp" />
- <fragment
- android:id="@+id/map3"
- android:name="com.google.android.gms.maps.MapFragment"
- android:layout_width="250dp"
- android:layout_height="250dp"
- android:layout_marginLeft="30dp" />
- </LinearLayout>
- </HorizontalScrollView>
- </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement