title: How to list all installed applications in the device and allows the user to set individual password for each app?
body: <p>I have the code for listing installed apps in device but when i click for e.g Camera app, it opens the app. What i wanna do is not open the app, but locking it with password(a lock screen appears before that particular app launch), is it possible ? </p>
  
  <p>Here is my code for listing installed apps :</p>
  
  <pre><code>private PackageManager packageManager = null;
  private List&lt;ApplicationInfo&gt; applist = null;
  private ApplicationAdapter listadaptor = null;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.application);
  
      packageManager = getPackageManager();
  
      new LoadApplications().execute();
  }
  
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
      super.onListItemClick(l, v, position, id);
  
      ApplicationInfo app = applist.get(position);
      try {
          Intent intent = packageManager.getLaunchIntentForPackage(app.packageName);
  
          if (intent != null) {
              startActivity(intent);
          }
      } catch (ActivityNotFoundException e) {
          Toast.makeText(Application.this, e.getMessage(),
                  Toast.LENGTH_LONG).show();
      } catch (Exception e) {
          Toast.makeText(Application.this, e.getMessage(),
                  Toast.LENGTH_LONG).show();
      }
  }
  
  private List&lt;ApplicationInfo&gt; checkForLaunchIntent(List&lt;ApplicationInfo&gt; list) {
      ArrayList&lt;ApplicationInfo&gt; applist = new ArrayList&lt;ApplicationInfo&gt;();
      for (ApplicationInfo info : list) {
          try {
              if (packageManager.getLaunchIntentForPackage(info.packageName) != null) {
                  applist.add(info);
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  
      return applist;
  }
  
  private class LoadApplications extends AsyncTask&lt;Void, Void, Void&gt; {
      private ProgressDialog progress = null;
  
      @Override
      protected Void doInBackground(Void... params) {
          applist = checkForLaunchIntent(packageManager.getInstalledApplications(PackageManager.GET_META_DATA));
          listadaptor = new ApplicationAdapter(Application.this,R.layout.list_item, applist);
  
          return null;
      }
  
      @Override
      protected void onPostExecute(Void result) {
          setListAdapter(listadaptor);
          progress.dismiss();
          super.onPostExecute(result);
      }
  
      @Override
      protected void onPreExecute() {
          progress = ProgressDialog.show(Application.this, null,
                  "Loading application info...");
          super.onPreExecute();
      }
  }
  </code></pre>
  
  <p>The listing installed apps' code i found on youtube, here, <a href="https://www.youtube.com/watch?v=n6R-sc2QMVM" rel="nofollow">https://www.youtube.com/watch?v=n6R-sc2QMVM</a> </p>
  
  <p>I'm new in developing android and I'm really interested in developing my own app locker. Sorry for my bad english, any help would be appreciated !</p>