public class BottomMain extends LinearLayout implements OnClickListener  {
private ImageView back, main, set, exit; 
/**当前活动Activity*/
    public static Class<?> objActive=  Main.class;
    public static Class<?> setting =  SysSettingActivity.class;
    public static Class<?> backClass =  Main.class;
private Context context;

public BottomMain(Context context) { super(context);
this.context = context;  
LayoutInflater lInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
lInflater.inflate(R.layout.bottm, this);
back = (ImageView) findViewById(R.id.back);
main = (ImageView) findViewById(R.id.main);
set = (ImageView) findViewById(R.id.set);
exit = (ImageView) findViewById(R.id.exit);  back.setOnClickListener(this);
main.setOnClickListener(this);
set.setOnClickListener(this);
exit.setOnClickListener(this); } public BottomMain(Context context, AttributeSet aSet) { super(context, aSet);
this.context = context; 
LayoutInflater lInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
lInflater.inflate(R.layout.bottm, this);


back = (ImageView) findViewById(R.id.back);
main = (ImageView) findViewById(R.id.main);
set = (ImageView) findViewById(R.id.set);
exit = (ImageView) findViewById(R.id.exit); 
back.setOnClickListener(this);
main.setOnClickListener(this);
set.setOnClickListener(this);
exit.setOnClickListener(this);
  }
 
  public void onClick(View v) {


if (back == v) {  
Intent intent_stop = new Intent(context, objActive); 
context.stopService(intent_stop); Intent intent = new Intent(context, backClass);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
context.startActivity(intent);  
 
}
if (main == v) {
Intent intent = new Intent(context, objActive);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);  context.startActivity(intent); 
 
}
if (set == v) {
Intent intent = new Intent(context, setting);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);  context.startActivity(intent); 
}
if (exit == v) {
Dialog dialog1 = new AlertDialog.Builder(context).setTitle("提示").setMessage("确定要退出系统么?").setPositiveButton("确认", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog1, int whichButton) {

 SharedPreferences settings = context.getSharedPreferences("PARAM", 0) ;
 SharedPreferences.Editor editor = settings.edit();  
 //editor.putString("URL",ConfigApp.LOGIN_URL); 
 editor.putBoolean("loginState",false); 
 editor.commit(); 
 dialog1.dismiss();
 //android.os.Process.killProcess(android.os.Process.myPid());
 Intent startMain = new Intent(Intent.ACTION_MAIN);
         startMain.addCategory(Intent.CATEGORY_HOME);
         startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         context.startActivity(startMain);
         System.exit(0);
} }).setNeutralButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { }
}).create();
dialog1.show();
}
 
   }   
}