Created by Saksham Agarwal / Piyush Bhopalka
TextView tv = (TextView)findViewById(R.id.my_text_view);
tv.setText("Hello text view");
EditText editText = (EditText)findViewById(R.id.my_edit_text);
String s = editText.getText().toString();
Button b = (Button)findViewById(R.id.my_button);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/* Whatever you may want to do on Click */
}
});
Two EditTexts For input
Four buttons, one each for basic arithmetic operations
After completion, check to see if you have done the same as here
The same code can be written efficiently like this
Choose Empty Activity, not Blank Activity
Intent i = new Intent(MainActivity.this, Activity2.class);
startActivity(i);
Intent i = new Intent(MainActivity.this, Activity2.class);
i.putExtra("my_key", "The text to be passed");
startActivity(i);
Intent i = getIntent();
String s = i.getStringExtra("my_key");
Explicit Intents - Intents within an app
Implicit Intents - Intents sent to another app on your device
String url = "http://www.facebook.com/groups/nitcdroid";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(i);
String url = "http://www.facebook.com/groups/nitcdroid";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(Intent.createChooser(i, "Visit NITC-Droid using"));
Create a Contacts app which displays several contacts each having:
Optional: Clicking on the contact should open dialer with that number
Next slide contains a demo of how the app should look likeYour app should look something like this:
- That's it for Week 1
- We just barely scratched through the tip of a few things. Self study is going to be the key.
- For deeper understanding, go through the Udacity Course or the Android Developer Website.
- Next week we will dive a little deeper into Views