English 中文(简体)
2. 如何估价从一个数值中得出的数值 甲型六氯环己烷中另一项活动的活动
原标题:How to append a value coming from oneActivity on Another Activity in android

i 有两个活动,从一项活动中取出图像,并将这一价值传给下一个活动,并将它储存在案文中。 目 录 当一取得下一个六氯乙烯价值并转至第二个活动时,案文中较早的数值 观点被新的六氯乙烯价值所取代。 现在需要的是,我想要把目前的价值与以前的价值相提并论。

页: 1 i 获取图像材料

public class Selectpassword extends Activity {
/** Called when the activity is first created. */
Bitmap overlay;      
Paint pTouch;
int X = -100;
int Y = -100;
Canvas c2;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent mIntent = getIntent();
    int intValue = mIntent.getIntExtra("intVariableName", 0);
    System.out.println("+++++++++++++++++++++"+intValue);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    Bitmap mBitmap = BitmapFactory.decodeResource(getResources(),intValue);
    Bitmap mBitmapover = BitmapFactory.decodeResource(getResources(), intValue);
    overlay = BitmapFactory.decodeResource(getResources(),intValue).copy(Config.ARGB_8888, true);  
    c2 = new Canvas(overlay);

    pTouch = new Paint(Paint.ANTI_ALIAS_FLAG);         
  //  pTouch.setXfermode(new PorterDuffXfermode(Mode.TARGET); 
    pTouch.setColor(Color.TRANSPARENT);
    pTouch.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL));
    setContentView(new BitMapView(this, mBitmap,mBitmapover));
}

class BitMapView extends View {
    Bitmap mBitmap = null;
    Bitmap mBitmapover = null;

    public BitMapView(Context context, Bitmap bm, Bitmap bmover) {
    super(context);
    mBitmap = bm;
    mBitmapover = bmover;
    }
     @Override
     public boolean onTouchEvent(MotionEvent ev) {

         switch (ev.getAction()) {

             case MotionEvent.ACTION_DOWN: {

                 X = (int) ev.getX();
                 Y = (int) ev.getY();


                 System.out.println("+++++++++++++++++++++++++++++"+X);
                 System.out.println("+++++++++++++++++++++++++++++"+Y);
                 invalidate();
                 Intent intent = new Intent(Selectpassword.this,Catogry.class); 
                 intent.putExtra("intVariableName", X);//i put the value of the pixels
                // intent.putExtra("intVariableName", Y);
                 startActivity(intent);

                 break;
             }

             case MotionEvent.ACTION_MOVE: {

                     X = (int) ev.getX();
                     Y = (int) ev.getY();
                     invalidate();
                     break;

             }           

             case MotionEvent.ACTION_UP:

                 break;

         }
         return true;
     }


    @Override
    protected void onDraw(Canvas canvas) {
    // called when view is drawn
    Paint paint = new Paint();
    paint.setFilterBitmap(true);


    //draw background
    canvas.drawBitmap(mBitmap, 0, 0, null);
    //copy the default overlay into temporary overlay and punch a hole in it                          
    c2.drawBitmap(mBitmapover, 0, 0, null); //exclude this line to show all as you draw
    c2.drawCircle(X, Y, 80, pTouch);
    //draw the overlay over the background  
    canvas.drawBitmap(overlay, 0, 0, null);
    }
}

  }

/Catogry.java(在案文中看上去看皮条)

public class Catogry extends Activity {

 LinearLayout background;
 Spinner spinnerColor;
 TextView password;

 private static final String[] colorf =
  { "SELECT ANY FIELD","ANIMAL",  
  "BIRDS",
  "BABYS",
  };
 private ArrayAdapter<String> adapter;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.catogry);



    spinnerColor = (Spinner)findViewById(R.id.colorspinner);
    adapter = new ArrayAdapter<String>(this, 
      android.R.layout.simple_spinner_item, colorf);
    adapter.setDropDownViewResource(
      android.R.layout.simple_spinner_dropdown_item);
    spinnerColor.setAdapter(adapter);
    spinnerColor.setSelection(0);
    Intent mIntent = getIntent();
    int passwords = mIntent.getIntExtra("intVariableName", 0);//getting the pixel and convent the values to string
    password=(TextView)findViewById(R.id.appenpass);//text view
  // password.setText(Integer.toString(passwords));
    password.append(Integer.toString(passwords));//appending the values
    spinnerColor.setOnItemSelectedListener(
      new Spinner.OnItemSelectedListener(){

  public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) {
  // TODO Auto-generated method stub
  // setBackgroundColor(spinnerColor.getSelectedItem().toString());

  switch(position){
   case 0:

   break;
   case 1:
   //call second class
       Intent animal=new Intent(Catogry.this,Animals.class);
       startActivity(animal);

   break;
   case 2:
   //call third class
       Intent bird=new Intent(Catogry.this,Birds.class);
       startActivity(bird);
   break;
   case 3:
       //call third class
           Intent baby=new Intent(Catogry.this,Babys.class);
           startActivity(baby);
       break;

   default:
   break;
       }
  }


  public void onNothingSelected(AdapterView<?> arg0) {
   // TODO Auto-generated method stub

  }});
   }



 }
最佳回答

没有人回答这个问题,我认为这是自己。

我从一页到另一页,这意味着:一是从信封的页上拿到纸浆,然后从那页到信封的页上转到下一个活动。

String canvas=""; canvas=canvas+X;(THe X is an integer where i had converted the X in to a String ) and pass the canvas values so that i have successfully append my value.

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签