Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Header extends LinearLayout{
- private Context mContext;
- private ImageView btn12;
- private ImageView btn11;
- public static RadioGroup radioGroup1 = Select.radioGroup;
- private Button btn13;
- private Button btn14;
- String myString,un;
- private TextView topbar1;
- private String un1=questionsselection.un;
- private String myString1=questionsselection.myString;
- //private String value=Select.op1val;
- private RadioGroup rbgrp;
- private static int i=1;
- private int val=Integer.parseInt(un1);
- RadioButton numb1=Select.op1;
- RadioButton numb2=Select.op2;
- RadioButton numb3=Select.op3;
- RadioButton numb4=Select.op4;
- RadioButton numb5=Select.op5;
- String answer=null;
- private SharedPreferences mPreferences2;
- public Header(Context context, AttributeSet attrs) {
- super(context, attrs);
- Log.i("un values",un1);
- mContext = context;
- String infService = Context.LAYOUT_INFLATER_SERVICE;
- LayoutInflater li;
- li = (LayoutInflater) getContext().getSystemService(infService);
- li.inflate(R.layout.header, this, true);
- ImageView topbar=(ImageView)findViewById(R.id.topbar);
- topbar1=(TextView)findViewById(R.id.number);
- System.out.println(i);
- System.out.println(myString1);
- btn11 = (ImageView) findViewById(R.id.next);
- btn11.setOnClickListener(mFooterListener);
- btn12 = (ImageView) findViewById(R.id.home);
- btn12.setOnClickListener(mhome);
- if(myString1=="0")
- {
- topbar.setBackgroundResource(R.drawable.alltab);
- }
- else if(myString1=="1")
- {
- topbar.setBackgroundResource(R.drawable.medicinetab);
- }
- else if(myString1=="2")
- {
- topbar.setBackgroundResource(R.drawable.obgyntab);
- }
- else if(myString1=="3")
- {
- topbar.setBackgroundResource(R.drawable.pmchtab);
- }
- else if(myString1=="4")
- {
- topbar.setBackgroundResource(R.drawable.pediatricstab);
- }
- else if(myString1=="5")
- {
- topbar.setBackgroundResource(R.drawable.psychiatrytab);
- }
- else if(myString1=="6")
- {
- topbar.setBackgroundResource(R.drawable.surgerytab);
- }
- }
- public void init() {
- // set init otherwise of ctor and call externally...
- }
- private OnClickListener mhome = new OnClickListener() {
- public void onClick(View v) {
- new AlertDialog.Builder(mContext).setTitle("MCCEE" )
- .setMessage("Do You Want To Quit The Test?")
- .setPositiveButton("OK", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- //Write the intent here.
- mContext.startActivity( new Intent(mContext,homepage.class));
- // startActivity(reg2);
- }
- }).show();
- // Context.startActivity(new Intent(mContext, homepage.class));
- }
- };
- // Create an anonymous implementation of OnClickListener
- private OnClickListener mFooterListener = new OnClickListener() {
- public void onClick(View v) {
- try
- {
- if(i<val)
- {
- int selected = radioGroup1.getCheckedRadioButtonId();
- numb1 = (RadioButton) findViewById(selected);
- System.out.print("Get radiobutton id");
- System.out.print(numb1.getId());
- /*radioGroup1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
- public void onCheckedChanged(RadioGroup rg, int checkedId) {
- for(int i=0; i<rg.getChildCount(); i++) {
- RadioButton op11 = (RadioButton) rg.getChildAt(i);
- if(op11.getId() == checkedId) {
- System.out.print(getId());
- //String text = btn.getText();
- // do something with text
- }
- }
- }
- });
- */
- //String value=Select.op1val;
- // Log.i("111",value);
- System.out.println("valllll"+val);
- System.out.println("iii"+i);
- mContext.startActivity(new Intent(mContext, Select.class));
- i++;
- System.out.println("after inc i"+i);
- }
- else
- {
- i=1;
- new AlertDialog.Builder(mContext).setTitle("MCCEE" )
- .setMessage("Test Completed")
- .setPositiveButton("OK", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int whichButton) {
- //Write the intent here.
- mContext.startActivity( new Intent(mContext,Analysis.class));
- // startActivity(reg2);
- }
- }).show();
- }
- }
- catch(Exception e){
- String err = (e.getMessage()==null)?"SD Card failed":e.getMessage();
- Log.e("sdcard-err2:",err);
- }
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement