Java Code Examples for android.os.Bundle

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  22 
vote

@Override public void dispatchInvalidateOptionsMenu(){
  if (DEBUG)   Log.d(TAG,"[dispatchInvalidateOptionsMenu]");
  Bundle savedActionViewStates=null;
  if (mMenu != null) {
    savedActionViewStates=new Bundle();
    mMenu.saveActionViewStates(savedActionViewStates);
    if (savedActionViewStates.size() > 0) {
      mMenuFrozenActionViewState=savedActionViewStates;
    }
    mMenu.stopDispatchingItemsChanged();
    mMenu.clear();
  }
  mMenuRefreshContent=true;
  if (wActionBar != null) {
    mMenuIsPrepared=false;
    preparePanel();
  }
}
 

Example 2

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: CommitDetailsFragment.java

  22 
vote

public static CommitDetailsFragment newInstance(File gitdir,String revision){
  CommitDetailsFragment f=new CommitDetailsFragment();
  Bundle args=new Bundle();
  args.putString(GITDIR,gitdir.getAbsolutePath());
  args.putString(REVISION,revision);
  f.setArguments(args);
  return f;
}
 

Example 3

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: WebFragment.java

  20 
vote

static WebFragment newInstance(final String url){
  final WebFragment f=new WebFragment();
  final Bundle args=new Bundle();
  args.putString(URL,url);
  f.setArguments(args);
  return f;
}
 

Example 4

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: FragmentAlertDialogSupport.java

  19 
vote

public static MyAlertDialogFragment newInstance(int title){
  MyAlertDialogFragment frag=new MyAlertDialogFragment();
  Bundle args=new Bundle();
  args.putInt("title",title);
  frag.setArguments(args);
  return frag;
}
 

Example 5

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  18 
vote

@Override public void dispatchInvalidateOptionsMenu(){
  if (DEBUG)   Log.d(TAG,"[dispatchInvalidateOptionsMenu]");
  Bundle savedActionViewStates=null;
  if (mMenu != null) {
    savedActionViewStates=new Bundle();
    mMenu.saveActionViewStates(savedActionViewStates);
    if (savedActionViewStates.size() > 0) {
      mMenuFrozenActionViewState=savedActionViewStates;
    }
    mMenu.stopDispatchingItemsChanged();
    mMenu.clear();
  }
  mMenuRefreshContent=true;
  if (wActionBar != null) {
    mMenuIsPrepared=false;
    preparePanel();
  }
}
 

Example 6

From project Absolute-Android-RSS, under directory /src/com/AA/Recievers/.

Source file: AAWidgetProvider.java

  18 
vote

/** 
 * Updates the widget with the newest article
 * @param context - Context that gives us access to some system operations
 * @param intent - The intent that launched this receiver
 */
private static void updateArticles(Context context,Intent intent){
  Bundle articleBundle=intent.getBundleExtra("articles");
  ArrayList<String> titles=articleBundle.getStringArrayList("titles");
  ArrayList<Article> articles=new ArrayList<Article>();
  if (titles == null)   titles=new ArrayList<String>();
  for (  String title : titles)   articles.add((Article)articleBundle.getSerializable(title));
  Collections.sort(articles);
  if (!articles.isEmpty())   updateWidget(context,articles.get(0).getTitle(),articles.get(0).getDescription());
 else   updateWidget(context,"Uh Oh","Something happened. No data received");
}
 

Example 7

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/widget/.

Source file: SuggestionsAdapter.java

  18 
vote

private void updateSpinnerState(Cursor cursor){
  Bundle extras=cursor != null ? cursor.getExtras() : null;
  if (DBG) {
    Log.d(LOG_TAG,"updateSpinnerState - extra = " + (extras != null ? extras.getBoolean(SearchManager.CURSOR_EXTRA_KEY_IN_PROGRESS) : null));
  }
  if (extras != null && extras.getBoolean(SearchManager.CURSOR_EXTRA_KEY_IN_PROGRESS)) {
    return;
  }
}
 

Example 8

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: BlobViewFragment.java

  18 
vote

public static BlobViewFragment newInstance(File gitdir,String revision,String path){
  BlobViewFragment f=new BlobViewFragment();
  Bundle args=new Bundle();
  args.putString(GITDIR,gitdir.getAbsolutePath());
  args.putString(UNTIL_REVS,revision);
  args.putString(PATH,path);
  f.setArguments(args);
  return f;
}
 

Example 9

From project 4308Cirrus, under directory /tendril-example/src/main/java/edu/colorado/cs/cirrus/android/.

Source file: DeviceDetailActivity.java

  17 
vote

@Override public void onStart(){
  super.onStart();
  Devices devices=null;
  Bundle bundle=this.getIntent().getExtras();
  int deviceNumber=0;
  deviceNumber=bundle.getInt("deviceID");
  try {
    this.showLoadingProgressDialog();
    devices=tendril.fetchDevices();
    Device targetDevice=devices.getDevice().get(deviceNumber);
    TextView deviceName=(TextView)findViewById(R.id.device_name);
    deviceName.setText(targetDevice.getName());
    TextView deviceID=(TextView)findViewById(R.id.device_id);
    deviceID.setText(targetDevice.getDeviceId());
    TextView marketingName=(TextView)findViewById(R.id.device_marketing_name);
    marketingName.setText(targetDevice.getMarketingName());
    TextView networkID=(TextView)findViewById(R.id.device_network_id);
    networkID.setText(targetDevice.getNetworkId());
  }
 catch (  Exception e) {
    e.printStackTrace();
    Toast.makeText(getApplicationContext(),e.getLocalizedMessage(),Toast.LENGTH_LONG).show();
  }
 finally {
    this.dismissProgressDialog();
  }
}
 

Example 10

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAMain.java

  17 
vote

/** 
 * Called when the activity is created and put into memory. This is where all GUI elements should be set up and any other member variables that is used throughout the class
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  articles=new ArrayList<Article>();
  settings=this.getSharedPreferences("settings",0);
  AlarmReceiver.stopAlarm(this);
  adapter=new ArticleAdapter(this);
  this.setListAdapter(adapter);
  ib_refresh=(ImageButton)findViewById(R.id.ib_refresh);
  TextView tv=(TextView)findViewById(R.id.AATitle);
  Typeface face=Typeface.createFromAsset(getAssets(),"fonts/WREXHAM_.TTF");
  tv.setTypeface(face);
  finishReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      articles.clear();
      Bundle articleBundle=intent.getBundleExtra("articles");
      ArrayList<String> titles=articleBundle.getStringArrayList("titles");
      for (      String title : titles)       articles.add((Article)articleBundle.getSerializable(title));
      progressDialog.cancel();
      refresh();
    }
  }
;
  this.registerReceiver(finishReceiver,new IntentFilter("RSSFinish"));
  ib_refresh.setOnClickListener(new OnClickListener(){
    /** 
 * Handles when the user clicks the refresh button
 * @param v - view that was clicked
 */
    @Override public void onClick(    View v){
      runService();
    }
  }
);
  runService();
}
 

Example 11

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/.

Source file: ActionBarSherlockCompat.java

  15 
vote

@Override public void dispatchPostCreate(Bundle savedInstanceState){
  if (DEBUG)   Log.d(TAG,"[dispatchOnPostCreate]");
  if (mIsDelegate) {
    mIsTitleReady=true;
  }
  if (mDecor == null) {
    initActionBar();
  }
}
 

Example 12

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: MainMenuActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mainMenuActivity=this;
  setContentView(R.layout.menu);
  Button newGameButtonHuman=(Button)findViewById(R.id.n_game_human);
  newGameButtonHuman.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.GAMEOPTIONS");
      intent.putExtra("vs","human");
      startActivity(intent);
    }
  }
);
  Button newGameButtonCpu=(Button)findViewById(R.id.n_game_cpu);
  newGameButtonCpu.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.GAMEOPTIONS");
      intent.putExtra("vs","cpu");
      startActivity(intent);
    }
  }
);
  Button resumeButton=(Button)findViewById(R.id.resume_game);
  resumeButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.RESUMEGAME");
      intent.putExtra("type","resume");
      startActivity(intent);
    }
  }
);
  Button tutorialButton=(Button)findViewById(R.id.tutorial);
  tutorialButton.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent("com.bytopia.abalone.TUTORIAL");
      startActivity(intent);
    }
  }
);
}
 

Example 13

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: SelectLayoutActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  layouts=new ArrayList<Layout>();
  for (  String layout : getResources().getStringArray(R.array.game_layouts)) {
    String tempAi="com.bytopia.abalone.mechanics." + layout;
    try {
      Class layoutClass=Class.forName(tempAi);
      Layout l=(Layout)layoutClass.newInstance();
      layouts.add(l);
    }
 catch (    Exception e1) {
      e1.printStackTrace();
    }
  }
  setContentView(R.layout.layout_selecting);
  boardView=new BoardView(getApplicationContext()){
    @Override public boolean onTouchEvent(    MotionEvent e){
      if (e.getAction() == MotionEvent.ACTION_UP) {
        String name=layouts.get(index).getClass().getName();
        SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
        preferences.edit().putString("layout",name).commit();
        finish();
      }
      return true;
    }
  }
;
  prev=(Button)findViewById(R.id.slect_layout_prev);
  next=(Button)findViewById(R.id.slect_layout_next);
  refrashLayout();
  LinearLayout linearLayout=(LinearLayout)findViewById(R.id.layout_selecting_layout);
  linearLayout.addView(boardView);
}
 

Example 14

From project AChartEngine, under directory /client/src/org/achartengine/demo/.

Source file: Demo.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getWindow().requestFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.main);
  getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.titlebar_icon);
  findViewById(R.id.button_multiseries_data_provider).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Uri u=DataContentProvider.BASE_URI.buildUpon().appendPath(DataContentProvider.CHART_DATA_MULTISERIES_PATH).appendPath(DataContentProvider.CHART_DATA_UNLABELED_PATH).build();
      Intent i=new Intent(Intent.ACTION_VIEW,u);
      i.putExtra(Intent.EXTRA_TITLE,TemperatureData.DEMO_CHART_TITLE);
      startActivity(i);
    }
  }
);
  findViewById(R.id.button_labeled_multiseries_data_provider).setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      Uri u=DataContentProvider.BASE_URI.buildUpon().appendPath(DataContentProvider.CHART_DATA_MULTISERIES_PATH).appendPath(DataContentProvider.CHART_DATA_LABELED_PATH).build();
      Intent i=new Intent(Intent.ACTION_VIEW,u);
      i.putExtra(Intent.EXTRA_TITLE,DonutData.DEMO_CHART_TITLE);
      startActivity(i);
    }
  }
);
}
 

Example 15

From project actionbar, under directory /actionbar-example/src/main/java/com/github/erd/actionbar/widget/.

Source file: ActionbarChooser.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.activity_chooser);
  Button button1=(Button)findViewById(R.id.button1);
  button1.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample1.class));
    }
  }
);
  Button button2=(Button)findViewById(R.id.button2);
  button2.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample2.class));
    }
  }
);
  Button button3=(Button)findViewById(R.id.button3);
  button3.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample3.class));
    }
  }
);
  Button button4=(Button)findViewById(R.id.button4);
  button4.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      startActivity(new Intent(v.getContext(),ActionbarExample4.class));
    }
  }
);
}
 

Example 16

From project actionbar, under directory /actionbar-example/src/main/java/com/github/erd/actionbar/widget/.

Source file: ActionbarExample1.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  setContentView(R.layout.activity_actionbar_1);
  Actionbar actionbar=(Actionbar)findViewById(R.id.action_bar);
  actionbar.setOnHomeClickListener(new Actionbar.OnHomeClickListener(){
    @Override public void onHomeClicked(    View view,    int icon){
      Log.v("Actionbar","Home button clicked...");
    }
  }
);
}
 

Example 17

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarHelperBase.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onSaveInstanceState(Bundle outState){
  if (mExpandedMenuPresenter != null && mExpandedMenuPresenter.mCurrentExpandedItem != null) {
    outState.putInt(KEY_EXPANDED_ITEM,mExpandedMenuPresenter.mCurrentExpandedItem.getItemId());
  }
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat != null) {
    SparseArray<Parcelable> stateArray=new SparseArray<Parcelable>();
    actionBarCompat.saveHierarchyState(stateArray);
    outState.putSparseParcelableArray(KEY_HIERARCHY_STATE,stateArray);
  }
}
 

Example 18

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarHelperBase.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onRestoreInstanceState(Bundle savedInstanceState){
  int itemId=savedInstanceState.getInt(KEY_EXPANDED_ITEM);
  if (itemId != 0 && mExpandedMenuPresenter != null && mMenu != null) {
    final SimpleMenuItem item=(SimpleMenuItem)mMenu.findItem(itemId);
    if (item != null) {
      item.expandActionView();
    }
  }
  final ViewGroup actionBarCompat=getActionBarCompat();
  if (actionBarCompat != null) {
    SparseArray<Parcelable> stateArray=savedInstanceState.getSparseParcelableArray(KEY_HIERARCHY_STATE);
    if (stateArray != null) {
      actionBarCompat.restoreHierarchyState(stateArray);
    }
  }
}
 

Example 19

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: AboutActivity.java

  15 
vote

@Override protected void onCreate(final Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_about);
  moogAudioIV.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    final View v){
      ActivityController.onUrlClicked(AboutActivity.this,Const.MOOG_AUDIO_URL);
    }
  }
);
  cipcIV.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    final View v){
      ActivityController.onUrlClicked(AboutActivity.this,Const.CIPC_URL);
    }
  }
);
  aboutTV.setText(Html.fromHtml(REALISED_BY_HTML));
  Linkify.addLinks(aboutTV,0);
  aboutTV.setMovementMethod(LinkMovementMethod.getInstance());
}
 

Example 20

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: AboutActivity.java

  15 
vote

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

Example 21

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: ContributeActivity.java

  15 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.contribute);
  yes.setOnClickListener(this);
  no.setOnClickListener(this);
}