• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android - how to get/set value from/to imageview ?

artiny

Lurker
I would like to modify this program:
http://www.techrepublic.com/blog/software-engineer/bouncing-a-ball-on-androids-canvas/

in the file animetedview.java, I would like to change the variable xVelocity from Main.java.
private int xVelocity = 10;


or read the number to other activity from / y += yVelocity; / from OnDrawn function to Main.java


//What I have tried:
//create Menu.java to read value from edittext and pass to main.java
Java:
public class menu extends Activity {
    Button btn1;
    EditText et;
    double vv0 = 0.0;
 

  //  Button vV0;
    //public final static Double EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.secondlayout);
        //add a variable for button ANIM
        btn1 =(Button) findViewById(R.id.button3);
        et = (EditText) findViewById(pociatocnaRychlost);
    }
 
    public void onGetAnimate(View view){
        Intent i = new Intent(this, AnimatedView.class);
        Double vvv = Double.parseDouble(et.getText().toString());
        i.putExtra("rychlost0",vvv);
        startActivity(i);
    }

//main.java
Java:
public class Main extends Activity {
 

 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        Intent in = getIntent();
        Double valueV = in.getDoubleExtra("rychlost0",20);
    }
 
Back
Top Bottom