23.07.2015 Views

Android Tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

tnProduct.setOnClickListener(new OnClickListener() {<br />

@Override<br />

public void onClick(View view) {<br />

String t1 = edText1.getText().toString();<br />

String t2 = edText2.getText().toString();<br />

String t3 = edText3.getText().toString();<br />

int i1 = Integer.parseInt(t1);<br />

int i2 = Integer.parseInt(t2);<br />

int i3 = Integer.parseInt(t3);<br />

}<br />

});<br />

}<br />

int product = i1*i2*i3;<br />

Toast.makeText(getApplicationContext(),<br />

String.valueOf(product),Toast.LENGTH_LONG).show();<br />

}<br />

@Override<br />

public boolean onCreateOptionsMenu(Menu menu) {<br />

/* Inflate the menu; this adds items to the action bar<br />

if it is present */<br />

getMenuInflater().inflate(R.menu.main, menu);<br />

return true;<br />

}<br />

Following will be the content of res/layout/activity_main.xml file:<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!