title: trying to add userdetails from webservice on navigation drawer header
body: <p>I am new to android. I have being trying to implement job portal application. Now in trying to invoke webservices and getting responses. But my problem is that when I am calling webservice everything is working fine but user details like <code>username</code> and <code>email</code>, <code>id</code> are not displaying on navigation drawer header. Please help me out.
  Here is my piece of code:</p>
  
  <pre><code>public class UserHome extends FragmentActivity {
      private static final CharSequence Vanaja = null;
      private static final int PRETTY_PRINT_INDENT_FACTOR = 4;
      public  static String OPERATION_NAME = "loginvalidate"; 
      static boolean errored = false;
  
      private static final CharSequence Home = null;
  
      private DrawerLayout mDrawerLayout;
  
      protected ListView mDrawerList;
     private ActionBarDrawerToggle mDrawerToggle;
  
      // nav drawer title
      protected CharSequence mDrawerTitle;
  
      // used to store app title
    protected CharSequence mTitle;
      int childcount;
  
      // slide menu items
      protected String[] navMenuTitles;
      private TypedArray navMenuIcons;
  
  
     public  String emailvalue,passwordvalue;
  
  
  
  String emailid="";
  
   String password="";
  
      SoapObject result;
  protected ArrayList&lt;NavDrawerItem&gt; navDrawerItems;
      protected NavDrawerListAdapter adapter;
      protected FrameLayout frameLayout;
      TextView name,emailid1;
  
      public void getLoginValues(String emailid,String password)
      { emailvalue=emailid;
      passwordvalue=password;
  
  
      } 
      final String s=emailid;
      final String s1=password;
      /*public void getLoginValues(String editTextUsername,
              String editTextPassword) {
          emailvalue=editTextUsername;
          passwordvalue=editTextPassword;         
      }
      */
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_navigation1);
  
  
  
          name = (TextView)findViewById(R.id.industry11);
          emailid1=(TextView)findViewById(R.id.mail);
  
  
  
  
   try
   {
          final ActionBar bar = getActionBar();
          bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#BDBDBD")));
  
          @SuppressWarnings("unused")
          AsyncTaskRunner async=(AsyncTaskRunner) new AsyncTaskRunner(this).execute();
   mTitle = mDrawerTitle = getTitle();
  
          // load slide menu items
          navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items11);
  
          // nav drawer icons from resources
          navMenuIcons = getResources()
                  .obtainTypedArray(R.array.nav_drawer_icons22);
  
          mDrawerLayout=(DrawerLayout)findViewById(R.id.drawerlayout);
          mDrawerList = (ListView) findViewById(R.id.slidermenu);
          LayoutInflater inflater = getLayoutInflater();
  
  
          ViewGroup header = (ViewGroup)inflater.inflate(R.layout.userslider, mDrawerList, false);
          mDrawerList.addHeaderView(header, null, false);
          mDrawerLayout.closeDrawers();
      RelativeLayout update=(RelativeLayout)findViewById(R.id.update);
  update.setOnClickListener(new View.OnClickListener() {
  
       @SuppressWarnings("unused")
      @Override
       public void onClick(View v){
  
           switch (v.getId()) {
           case R.id.update:
  
               //what to put here
              FragmentManager fm = getFragmentManager();
              FragmentTransaction ft = fm.beginTransaction();
              ft.replace(R.id.frame_container, new ProfileUpdate());
               ft.commit();
           bar.setTitle("   Updae Profile");
  
  
           break;
        }
  
  
  
  
       }
  
       }
   );
  
  
         navDrawerItems = new ArrayList&lt;NavDrawerItem&gt;();
  
          // adding nav drawer items to array
          // Home
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
          // Find People
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1)));
          // Photos
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1)));
          // Communities, Will add a counter here
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1)));
          // Pages
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
          // What's hot, We  will add a counter here
          navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
  
  
  
          // Recycle the typed array
          navMenuIcons.recycle();
  
          mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
  
          // setting the nav drawer list adapter
          adapter = new NavDrawerListAdapter(getApplicationContext(),
                  navDrawerItems);
          mDrawerList.setAdapter(adapter);
  
  
          mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                  R.drawable.icd2, //nav menu toggle icon
                  R.string.drawer_open, // nav drawer open - description for accessibility
                  R.string.drawer_close // nav drawer close - description for accessibility
          ) {
              public void onDrawerClosed(View view) {
  
                  invalidateOptionsMenu();
              }
  
              public void onDrawerOpened(View drawerView) {
  
                  invalidateOptionsMenu();
              }
          };
          mDrawerLayout.setDrawerListener(mDrawerToggle);
  
  
          getActionBar().setDisplayHomeAsUpEnabled(true);
  
  
  
  
  
          bar.setIcon(R.color.transparent);
  
          if (savedInstanceState == null) {
              // on first time display view for first nav item
              displayView(1);
          }}
          catch(Exception e)
        {
            e.printStackTrace();
        }
  
      }
  
      /**
       * Slide menu item click listener
       * */
  
  
  
      private class SlideMenuClickListener implements
              ListView.OnItemClickListener {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
                  long id) {
              // display view for selected nav drawer item
              displayView(position);
          }
      }
  
   @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // toggle nav drawer on selecting action bar app icon/title
          if (mDrawerToggle.onOptionsItemSelected(item)) {
              return true;
          }
          // Handle action bar actions click
          switch (item.getItemId()) {
          case R.id.action_settings:
              return true;
          default:
              return super.onOptionsItemSelected(item);
          }
      }
  
      /***
       * Called when invalidateOptionsMenu() is triggered
       */
      @Override
      public boolean onPrepareOptionsMenu(Menu menu) {
          // if nav drawer is opened, hide the action items
          boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
          menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
  
          return super.onPrepareOptionsMenu(menu);
      }
  
      /**
       * Diplaying fragment view for selected nav drawer list item
       * */
  
      @SuppressWarnings("unused")
      private void displayView(int position) {
          // update the main content by replacing fragments
       Fragment fragment=null;
       String title="null";
          switch (position) {
  
          case 1:
              fragment =new SearchJobs1();
              title="";
             /* Intent intent1 = new Intent(getApplicationContext(),HomeFragment.class);
              startActivity(intent1);*/
          break;
         case 2:
             fragment =new LatestJobs();
          /*  Intent intent2 = new Intent(getApplicationContext(), Homepage.class);
              startActivity(intent2);*/
              break;
  
          case 3:
              fragment =new AppliedJobs();
          /*  Intent intent3 = new Intent(getApplicationContext(), FindPeopleFragment.class);
              startActivity(intent3);*/
              break;
  
          case 4:
              fragment =new ChangePassword();
            /*Intent intent4 = new Intent(getApplicationContext(), CommunityFragment.class);
              startActivity(intent4);*/
              break;
  
         case 5:
             fragment =new Unsubscribe();
           /* Intent intent5 = new Intent(getApplicationContext(),PagesFragment.class);
              startActivity(intent5);*/
              break;
  
  
          case 6:
              fragment =new LogOut();
           Intent intent6 = new Intent(getApplicationContext(),MainActivity.class);
              startActivity(intent6);
              break;
  
          /*case 6:
              fragment =new ContactUs();
            Intent intent6 = new Intent(getApplicationContext(),PhotosFragment.class);
              startActivity(intent6);
              break;
          case 7:
              fragment =new AboutUs();
            Intent intent6 = new Intent(getApplicationContext(),PhotosFragment.class);
              startActivity(intent6);
              break;*/
  
  
          default:
  
              break;
          }
  
         if (fragment != null) {
              FragmentManager fragmentManager = getFragmentManager();
              fragmentManager.beginTransaction()
                      .replace(R.id.frame_container, fragment).commit();
  
              // update selected item and title, then close the drawer
              mDrawerList.setItemChecked(position, true);
              mDrawerList.setSelection(position-1);
              setTitle(navMenuTitles[position-1]);
              mDrawerLayout.closeDrawer(mDrawerList);
          } else {
              // error in creating fragment
              Log.e("MainActivity", "Error in creating fragment");
          }
      }
  
      @Override
      public void setTitle(CharSequence title) {
          mTitle = title;
          getActionBar().setTitle(mTitle);
  
          getActionBar().setTitle("  " + mTitle);
      }
  
      /**
       * When using the ActionBarDrawerToggle, you must call it during
       * onPostCreate() and onConfigurationChanged()...
       */
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState) {
          super.onPostCreate(savedInstanceState);
          // Sync the toggle state after onRestoreInstanceState has occurred.
          mDrawerToggle.syncState();
      }
  
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
          super.onConfigurationChanged(newConfig);
          // Pass any configuration change to the drawer toggls
          mDrawerToggle.onConfigurationChanged(newConfig);
      }
  
  
      public void setActionBarTitle(String string) {
          // TODO Auto-generated method stub
  
          getActionBar().setTitle("  "  + string);
      }
  
       public void setActionBarImage(ImageView view)
          {
              Log.d("Tittlename", "image   is"+view);
              getActionBar().setCustomView(view);
          }
  
  
  
  
  
       private  class AsyncTaskRunner extends AsyncTask&lt;Void,Void,Void&gt;        {
  
              String result1;
              UserHome outer;
              public AsyncTaskRunner(UserHome outer) {
                 this.outer = outer;
              }
              private String TAG;
              @Override
              protected void onPreExecute() {
                  Log.i(TAG, "onPreExecute");
              }
  
  
              @Override
              protected Void doInBackground(Void... params) {
                  Log.i(TAG, "doInBackground");
                  WebserviceCall service=new WebserviceCall();
  try
  {
  /*if(isNetworkAvailable())
  {*/
  
  
      SoapObject result;
  result=service.invokeLoginWS(emailvalue, passwordvalue, OPERATION_NAME);
  
  
  
  /*
      String s=outer.emailid;
      String s1=outer.password;
  =======
  
      /*String s=UserHome.this.emailid;
      String s1=UserHome.this.password;*/
  
  /*  
  result=service.invokeLoginWS(s,s1," ");*/
  
  
      LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      vi.inflate(R.layout.user_home, null);
             String resultvalue=result.getProperty("firstname").toString();
             emailid= result.getProperty(0).toString();
             password = result.getProperty(1).toString();
  name.setText(resultvalue);
   resultvalue=result.getProperty("emailid").toString();
   emailid1.setText(resultvalue);
  /*else
  {
      Intent intent1 = new Intent(getActivity(),InternetProblem.class);
  
        startActivity(intent1);   
  }*/
  
  }
  catch(Exception e)
  {  
  Handler refresh = new Handler(Looper.getMainLooper());
  
  refresh.post(new Runnable() {
     public void run()
     {
      try {
          Intent intent1 = new Intent(getApplicationContext(),InternetProblem.class);
  
            startActivity(intent1);
                  } 
      catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
     }
  });  
  
  }
  /*Handler refresh = new Handler(Looper.getMainLooper());
                  refresh.post(new Runnable() {
                      public void run()
                      {
                          try {
                              serviceCall();
                          } catch (ParseException e) {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          }
                      }
  
                  });  */
  
  /*                  int childCount = result.getPropertyCount();
  */                 
                  return null;
              }
  
  
  
  
              @Override
              protected void onPostExecute(Void result) {
                  Log.i(TAG, "onPostExecute");
  
                                 }
  
  
          }
  }
  </code></pre>