Android Open Source - LearningAndroid2edYamba2 Main Activity






From Project

Back to project page LearningAndroid2edYamba2.

License

The source code is released under:

Apache License

If you think the Android project LearningAndroid2edYamba2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.marakana.android.yamba;
//from  w  w  w  .  j  a v  a 2  s.  c  o  m
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  }

  // Called to inflate the menu resource into the given Menu object
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return super.onCreateOptionsMenu(menu); // clk: not just return true, following
    // https://developer.android.com/training/basics/actionbar/adding-buttons.html
  }

  // Called every time user clicks on an action
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_settings:
      startActivity(new Intent(this, SettingsActivity.class));
      return true;
    case R.id.action_tweet:
      startActivity(new Intent("com.marakana.android.yamba.action.tweet"));
      return true;
    case R.id.action_refresh:
      startService(new Intent(this, RefreshService.class));
      return true;
    case R.id.action_purge:
      int rows = getContentResolver().delete(StatusContract.CONTENT_URI, null, null);
      Toast.makeText(this, "Deleted "+rows+" rows", Toast.LENGTH_LONG).show();
      return true;
    default:
      return false;
    }
  }
}




Java Source Code List

com.marakana.android.yamba.BootReceiver.java
com.marakana.android.yamba.DbHelper.java
com.marakana.android.yamba.DetailsActivity.java
com.marakana.android.yamba.DetailsFragment.java
com.marakana.android.yamba.FreshnessView.java
com.marakana.android.yamba.MainActivity.java
com.marakana.android.yamba.NotificationReceiver.java
com.marakana.android.yamba.RefreshService.java
com.marakana.android.yamba.SettingsActivity.java
com.marakana.android.yamba.SettingsFragment.java
com.marakana.android.yamba.StatusActivity.java
com.marakana.android.yamba.StatusContract.java
com.marakana.android.yamba.StatusFragment.java
com.marakana.android.yamba.StatusProvider.java
com.marakana.android.yamba.SubActivity.java
com.marakana.android.yamba.TimelineFragment.java
com.marakana.android.yamba.YambaWidget.java