use of android.view.View.OnClickListener in project coursera-android by aporter.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button loadButton = (Button) findViewById(R.id.button1);
loadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, NetworkingAndroidHttpClientJSONActivity.class));
}
});
}
use of android.view.View.OnClickListener in project coursera-android by aporter.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button loadButton = (Button) findViewById(R.id.button1);
loadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, NetworkingAndroidHttpClientXMLActivity.class));
}
});
}
use of android.view.View.OnClickListener in project coursera-android by aporter.
the class NetworkingSocketsActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mTextView = (TextView) findViewById(R.id.textView1);
final Button loadButton = (Button) findViewById(R.id.button1);
loadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new HttpGetTask().execute();
}
});
}
use of android.view.View.OnClickListener in project coursera-android by aporter.
the class NotificationStatusBarWithCustomViewActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mNotificationIntent = new Intent(getApplicationContext(), NotificationSubActivity.class);
mContentIntent = PendingIntent.getActivity(getApplicationContext(), 0, mNotificationIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
final Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Define the Notification's expanded message and Intent:
mContentView.setTextViewText(R.id.text, contentText + " (" + ++mNotificationCount + ")");
// Build the Notification
Notification.Builder notificationBuilder = new Notification.Builder(getApplicationContext()).setTicker(tickerText).setSmallIcon(android.R.drawable.stat_sys_warning).setAutoCancel(true).setContentIntent(mContentIntent).setSound(soundURI).setVibrate(mVibratePattern).setContent(mContentView);
// Pass the Notification to the NotificationManager:
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(MY_NOTIFICATION_ID, notificationBuilder.build());
}
});
}
use of android.view.View.OnClickListener in project coursera-android by aporter.
the class NotificationToastActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.toast_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(getLayoutInflater().inflate(R.layout.custom_toast, null));
toast.show();
}
});
}
Aggregations