public class MyMainActivity extends ListActivity {
int x;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadApps();
}
private void loadApps() {
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> mApps = getPackageManager().queryIntentActivities(
mainIntent, 0);
ListView listView = getListView();
listView.setAdapter(new AppsAdapter(this, mApps));
}
public class AppsAdapter extends BaseAdapter {
private LayoutInflater inflater;
private List<ResolveInfo> mApps;
public AppsAdapter(Context context, List<ResolveInfo> mApps) {
this.inflater = LayoutInflater.from(context);
this.mApps = mApps;
}
class ViewHandler {
TextView textLable;
ImageView iconImage;
Button buttn;
}
public View getView(final int position, View convertView,
ViewGroup parent) {
final ViewHandler Handler;
if (convertView == null) {
convertView = inflater.inflate(R.layout.customlist, null);
Handler = new ViewHandler();
Handler.textLable = (TextView) convertView
.findViewById(R.id.TV);
Handler.iconImage = (ImageView) convertView
.findViewById(R.id.IV);
Handler.buttn = (Button) convertView.findViewById(R.id.buttonx);
convertView.setTag(Handler);
} else {
Handler = (ViewHandler) convertView.getTag();
}
ResolveInfo info = this.mApps.get(position);
Handler.iconImage.setImageDrawable(info
.loadIcon(getPackageManager()));
Handler.textLable.setText(info.loadLabel(getPackageManager()));
Handler.buttn.setOnClickListener(new OnClickListener() {
boolean isClicked = false;
@Override
public void onClick(View v) {
if (isClicked == false) {
Handler.buttn.setBackgroundResource(R.drawable.locker);
Toast.makeText(getApplicationContext(), "" + position,
Toast.LENGTH_SHORT).show();
isClicked = true;
} else {
Handler.buttn
.setBackgroundResource(R.drawable.unlocked);
isClicked = false;
}
}
});
return convertView;
}
public final int getCount() {
return mApps.size();
}
public final Object getItem(int position) {
return mApps.get(position);
}
public final long getItemId(int position) {
return position;
}
}
}
How can I hide an application from all the applications from the menu? I just want to create an application for application hiding, for security or for personal reasons if any wants to hide an app he or she would use my application. That's why I want to know how to hide an application.