title: Getting window display from service android
body: <p>I am trying to display a window from service but don't getting it how to do this</p>
  
  <p>Here is my code-- </p>
  
  <p>In <code>onStart</code> method of Service </p>
  
  <pre><code>LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
      View view = inflater.inflate(R.layout.main1, null);
      WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
  
      WindowManager.LayoutParams params = new WindowManager.LayoutParams();
      params.type = 2002;
      params.format = 1;
      params.flags = 40;
      params.height = WindowManager.LayoutParams.FILL_PARENT;
      params.width = WindowManager.LayoutParams.FILL_PARENT;
      manager.addView(view, params);
  
       /** just a timer *****/
      textView = (TextView) view.findViewById(R.id.textView1);
      final Timer t = new Timer("hello", true);
      t.schedule(new TimerTask() {
  
      @Override
      public void run() {
          textView.post(new Runnable() {
  
          public void run() {
              seconds++;
              if (seconds == 60) {
              seconds = 0;
              minute++;
              }
              if (minute == 60) {
              minute = 0;
              hour++;
              }
              textView.setText(""
                  + (hour &gt; 9 ? hour : ("0" + hour)) + " : "
                  + (minute &gt; 9 ? minute : ("0" + minute))
                  + " : "
                  + (seconds &gt; 9 ? seconds : "0" + seconds));
  
          }
          });
  
      }
      }, 1000, 1000);
  
      view.findViewById(R.id.stop).setOnClickListener(
          new OnClickListener() {
  
          public void onClick(View v) {
              t.cancel();
          }
          });
  </code></pre>
  
  <p>But nothing shown up. How can i display my views in window from service?</p>