title: How to use different button to access same class?
body: <p>I have three activity. </p>
  
  <p><code>A</code>>><code>B</code>>><code>C</code></p>
  
  <p><code>C</code>>>return image and value to <code>B</code>>>return to <code>A</code>>>If textView not null can intent to <code>B</code> </p>
  
  <p><code>C</code> has a camera function which will return the <code>image</code> from <code>B</code> to <code>A</code>. </p>
  
  <p>In <code>A</code>, it has one <code>editText</code> and a <code>button</code>. If <code>editText</code> not <code>null</code>, it can be clicked and intent to <code>B</code> by passing the <code>value</code> and <code>image</code> for edit. But the problem now is, when I click the button, I will see the image display on the <code>image view</code> even it is not get the image from c! </p>
  
  <p>I know I can use <code>view.setImageDrawable(null)</code> to clear the image but it cannot work in my case since I access the <code>B</code> two times with different widget!</p>
  
  <p><strong>Activity C</strong></p>
  
  <pre><code>  ok.setOnClickListener(new View.OnClickListener()
          {
              public void onClick(View arg0)  //return to B
              {
                  Intent returnIntent=new Intent();
                  text=t.getText().toString();
                  b.setDrawingCacheEnabled(true);
                  b.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
                          View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
                  b.layout(0, 0, b.getMeasuredWidth(), b.getMeasuredHeight());
                  b.buildDrawingCache(true);
                  returnIntent.putExtra("text", text);
                  if (b.getDrawingCache() != null) {
                      Bitmap bitmap = Bitmap.createBitmap(b.getDrawingCache());
                      if (bitmap == null) {
                          Log.e("TAG", "getDrawingCache() == null");
                      }
                      Global.img = bitmap;
                  }
                  setResult(Activity.RESULT_OK, returnIntent);
                  finish();
              }
          });
      }
  </code></pre>
  
  <p><strong>Activity B</strong></p>
  
  <pre><code> public void onActivityResult(int requestCode,int resultCode, Intent data)
      {  //receive value and image from C
          if(requestCode==PROJECT_REQUEST_CODE) {
              if(data!=null&amp;&amp;data.hasExtra("text")) {
                  c = data.getStringExtra("text");
                  txt1.setText(c);
                  viewImage.setImageBitmap(Global.img);
              }
  
  
          }
          else if (requestCode==CAMERA_REQUEST_CODE)
          {
  
          }
      }
  
    b.setOnClickListener(new View.OnClickListener() {  // back to A
              public void onClick(View arg0) {
                  Intent returnIntent = new Intent();
                  a = "Project";
                  text = txt.getText().toString(); // amount
                  returnIntent.putExtra("text", text);
                  returnIntent.putExtra("a", a);
                  final int k1 = getIntent().getExtras().getInt("k");
                  returnIntent.putExtra("k1", k1);
                  returnIntent.putExtra("c",c);
                  setResult(Activity.RESULT_OK, returnIntent);
                  finish();
              }
          });
  </code></pre>
  
  <p><strong>Activity A</strong></p>
  
  <pre><code> @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {  //receive data from B
          int button = data.getIntExtra("k1", 0);
  
          if (button == 1) {
              switch (requestCode) {
                  case 0:
                      result = data.getStringExtra("text");
                      name = data.getStringExtra("a");
                      description=data.getStringExtra("c");
                      if (Global.img != null) {
                          v.setImageBitmap(Global.img);
                      }
  
                       as=Long.parseLong(result);
                      c.setText("            " + name + "------" + "RM " + result);
                      break;
  }
  
   c.setOnClickListener(new View.OnClickListener() { // if c is not null, it can intent to B.Otherwise it is not clickable
    @Override
        public void onClick(View view) {
        if ((name != null &amp;&amp; name.trim().length() &gt; 0) &amp;&amp; (result != null &amp;&amp; result.trim().length() &gt; 0)) {
        Toast.makeText(getActivity().getApplicationContext(), "not null", Toast.LENGTH_LONG).show();
         if (name.equals("Project")) {
         Intent intent = new Intent(getActivity(), Project1.class);
         Global.img = null;
         v.setDrawingCacheEnabled(true);
         v.measure(View.MeasureSpec.makeMeasureSpec(0,               View.MeasureSpec.UNSPECIFIED),
         View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
         v.getMeasuredWidth(), v.getMeasuredHeight());
         v.buildDrawingCache(true);
         intent.putExtra("name", name);
         intent.putExtra("result", result);
         intent.putExtra("description", description);
         if (v.getDrawingCache() != null) {
         Bitmap bitmap = Bitmap.createBitmap(v.getDrawingCache());
         if (bitmap == null) {
         Log.e("TAG", "getDrawingCache() == null");
                               }
         Global.img = bitmap;
         startActivity(intent);
                                               }
                                           } 
  
    button1.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  // Toast.makeText(getActivity().getApplicationContext(), fk + "", Toast.LENGTH_LONG).show();
                  AlertDialogRadio(a1);
  
  
              }
          });
  
   public void AlertDialogRadio(final int k) {
           final CharSequence[] ClaimsModel = {"B", "Petrol", "Car Maintenance"};
  
          AlertDialog.Builder alt_bld = new AlertDialog.Builder(getActivity());
          alt_bld.setTitle("Select a Claims");
          alt_bld.setSingleChoiceItems(ClaimsModel, -1, new DialogInterface
                  .OnClickListener() {
  
              public void onClick(DialogInterface dialog, int item) {
                  if (item == 0) {
                      Intent intent = new Intent(getActivity().getApplicationContext(), B.class);
                     intent.putExtra("k",k);
                      startActivityForResult(intent, 0);
                  }else{...}
  }
  </code></pre>
  
  <p><strong>In A I have textView and button. If textView is clicked, it should display an image on B imageView. If button is clicked, nothing should display on B imageView. Please help,I have no idea...</strong></p>