private void setUpUI(View view) { // TODO Auto-generated method stub txtChurchname = (TextView) view.findViewById(R.id.txtChurchname); txtChurchname.setText(Connector.getChurchName()); profilepix = (ImageView) view.findViewById(R.id.churchlogo); filePath = Environment.getExternalStorageDirectory().getPath(); // Set some vital information imagename = Connector.myPrefs.getString("CHURCH_LOGO", "NO_DATA"); String churchname = Connector.getChurchName(); if (churchname.equalsIgnoreCase("NO_CHURCH_FOUND")) { txtChurchname.setText("Nsore Devotional"); } else txtChurchname.setText(churchname); File file = new File(filePath + "/" + Connector.AppFolder + "/" + imagename); if (file.exists() && file.isFile()) { // Toast.makeText(this, imagename, Toast.LENGTH_LONG).show(); profilepix.setImageBitmap( ImageHelper.getCircledBitmap( Bitmap.createScaledBitmap( BitmapFactory.decodeFile(file.getAbsolutePath()), 80, 80, false), 20)); } else { // if(MainActivity.churchLogo!=null) // { // profilepix.setImageBitmap( // ImageHelper.getCircledBitmap(Bitmap.createScaledBitmap( churchLogo, 50, 50, false), // 20) ); // // } // else profilepix.setImageBitmap( ImageHelper.getCircledBitmap( Bitmap.createScaledBitmap( BitmapFactory.decodeResource(getResources(), R.drawable.appico), 80, 80, false), 20)); } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { navtopMenuTitles = getResources().getStringArray(R.array.nav_top_menu); navMenuIcons = getResources().obtainTypedArray(R.array.nav_top_menu_icons); navDrawerItems = new ArrayList<NavDrawerItem>(); for (int i = 0; i < navtopMenuTitles.length; i++) { try { NavDrawerItem object; String values = navtopMenuTitles[i]; if (values.equalsIgnoreCase("My Account")) { object = new NavDrawerItem(values, navMenuIcons.getResourceId(i, -1), true); } else { object = new NavDrawerItem(values, navMenuIcons.getResourceId(i, -1), false); } if (object != null) { navDrawerItems.add(object); } } catch (Exception e) { // TODO: handle exception } } rootView = inflater.inflate(R.layout.fragment_navigation_drawer, container, false); mDrawerListView = (ListView) rootView.findViewById(R.id.menues); adapter1 = new NavDrawerListAdapter(getActivity(), navDrawerItems); // Recycle the typed array navMenuIcons.recycle(); mDrawerListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } }); mDrawerListView.setAdapter(adapter1); mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); txtChurcName = (TextView) rootView.findViewById(R.id.txtChurchname); profilepix = (ImageView) rootView.findViewById(R.id.churchlogo); filePath = Environment.getExternalStorageDirectory().getPath(); // Set some vital information imagename = Connector.myPrefs.getString("CHURCH_LOGO", "NO_DATA"); String churchname = Connector.getChurchName(); if (churchname.equalsIgnoreCase("NO_CHURCH_FOUND")) { txtChurcName.setText("Nsore Devotional"); } else txtChurcName.setText(churchname); Log.e("File Name", imagename); Log.e("Server Date", imagename); // Toast.makeText(this, imagename + filePath+"/"+Connector.AppFolder+"/church_logo.jpg", // Toast.LENGTH_LONG).show(); File file = new File(filePath + "/" + Connector.AppFolder + "/" + imagename); if (file.exists() && file.isFile()) { // Toast.makeText(this, imagename, Toast.LENGTH_LONG).show(); profilepix.setImageBitmap( ImageHelper.getCircledBitmap( Bitmap.createScaledBitmap( BitmapFactory.decodeFile(file.getAbsolutePath()), 50, 50, false), 20)); } else { if (MainActivity.churchLogo != null) { profilepix.setImageBitmap( ImageHelper.getCircledBitmap(Bitmap.createScaledBitmap(churchLogo, 50, 50, false), 20)); } else profilepix.setImageBitmap( ImageHelper.getCircledBitmap( Bitmap.createScaledBitmap( BitmapFactory.decodeResource(getResources(), R.drawable.appico), 50, 50, false), 20)); } return rootView; }