Search in sources :

Example 86 with OnClickListener

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));
        }
    });
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) View(android.view.View)

Example 87 with OnClickListener

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));
        }
    });
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) View(android.view.View)

Example 88 with OnClickListener

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();
        }
    });
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Example 89 with OnClickListener

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());
        }
    });
}
Also used : NotificationManager(android.app.NotificationManager) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) View(android.view.View)

Example 90 with OnClickListener

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();
        }
    });
}
Also used : Toast(android.widget.Toast) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) View(android.view.View)

Aggregations

OnClickListener (android.view.View.OnClickListener)794 View (android.view.View)792 TextView (android.widget.TextView)492 Button (android.widget.Button)265 ImageView (android.widget.ImageView)256 Intent (android.content.Intent)183 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)91 ScrollView (android.widget.ScrollView)52 LinearLayout (android.widget.LinearLayout)49 Bundle (android.os.Bundle)43 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)30 BindView (butterknife.BindView)29 KeyEvent (android.view.KeyEvent)28 EditText (android.widget.EditText)28 DialogInterface (android.content.DialogInterface)27 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)25 FragmentManager (android.support.v4.app.FragmentManager)23