Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

In this page you can find the example usage for android.os Bundle putInt.

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:fr.cph.chicago.core.activity.BusActivity.java

@Override
public void onSaveInstanceState(final Bundle savedInstanceState) {
    savedInstanceState.putInt(bundleBusStopId, busStopId);
    savedInstanceState.putString(bundleBusRouteId, busRouteId);
    savedInstanceState.putString(bundleBusBound, bound);
    savedInstanceState.putString(bundleBusBoundTitle, boundTitle);
    savedInstanceState.putString(bundleBusStopName, busStopName);
    savedInstanceState.putString(bundleBusRouteName, busRouteName);
    savedInstanceState.putDouble(bundleBusLatitude, latitude);
    savedInstanceState.putDouble(bundleBusLongitude, longitude);
    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.github.chenxiaolong.dualbootpatcher.switcher.ZipFlashingOutputFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(EXTRA_IS_RUNNING, mIsRunning);
    outState.putInt(EXTRA_TASK_ID_FLASH_ZIPS, mTaskIdFlashZips);
}

From source file:app.hacked.AddProjectFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.add_project_fragment, null);

    ((TextView) view.findViewById(R.id.Title)).setTypeface(Typeface.create("sans-serif-thin", Typeface.NORMAL));

    ProjectNameET = (EditText) view.findViewById(R.id.ProjectNameET);
    SynopsisET = (EditText) view.findViewById(R.id.SynopsisET);
    DescET = (EditText) view.findViewById(R.id.DescET);
    TeamMemberET = (EditText) view.findViewById(R.id.TeamMemberET);
    TechET = (EditText) view.findViewById(R.id.ProjectNameET);

    ((Button) view.findViewById(R.id.CancelButton)).setOnClickListener(new View.OnClickListener() {
        @Override/*from  www .  j  av a  2 s .co  m*/
        public void onClick(View view) {
            getActivity().finish();
        }
    });

    ((Button) view.findViewById(R.id.addProjectButton)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (ProjectNameET.getText().toString().equals("")) {
                Toast.makeText(getActivity(), "A project needs a name for people to recognise!",
                        Toast.LENGTH_SHORT).show();
                return;
            }

            JSONObject post = new JSONObject();
            try {
                post.put("project_name", ProjectNameET.getText().toString());
                post.put("project_synopsis", SynopsisET.getText().toString());
                post.put("project_desc", DescET.getText().toString());
                post.put("project_team", TeamMemberET.getText().toString());
                post.put("project_tech", TechET.getText().toString());
                post.put("auth", API.md5(API.BETTER_THAN_NOTHING_STUFF_TO_PREVENT_INJECTION_ATTEMPTS
                        + ProjectNameET.getText().toString()));
            } catch (Exception e) {
                e.printStackTrace();
                Toast.makeText(getActivity(),
                        "An Error Was encountered parsing the entered details: " + e.getMessage(),
                        Toast.LENGTH_SHORT).show();
                return;
            }

            JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.POST,
                    "http://hackedioapp.networksaremadeofstring.co.uk/addproject.php", post,
                    new Response.Listener<JSONObject>() {
                        @Override
                        public void onResponse(JSONObject response) {
                            Log.e("response", response.toString());
                            try {
                                if (response.has("success") && response.getBoolean("success")) {
                                    Toast.makeText(getActivity(), "Project added successfully!",
                                            Toast.LENGTH_SHORT).show();

                                    if (getActivity().findViewById(R.id.ProjectDetails) != null) {
                                        Bundle arguments = new Bundle();
                                        arguments.putInt(ProjectDetailsFragment.PROJECTID,
                                                response.getInt("uuid"));
                                        arguments.putString(ProjectDetailsFragment.NAME,
                                                ProjectNameET.getText().toString());
                                        arguments.putString(ProjectDetailsFragment.SYNOPSIS,
                                                SynopsisET.getText().toString());
                                        arguments.putString(ProjectDetailsFragment.DESCRIPTION,
                                                DescET.getText().toString());
                                        arguments.putString(ProjectDetailsFragment.TECHNOLOGIES,
                                                TechET.getText().toString());
                                        arguments.putInt(ProjectDetailsFragment.POPULARITY, 1);
                                        arguments.putString(ProjectDetailsFragment.TEAMMEMBERS,
                                                TeamMemberET.getText().toString());
                                        arguments.putBoolean(ProjectDetailsFragment.ARG_2PANE, true);

                                        ProjectDetailsFragment fragment = new ProjectDetailsFragment();
                                        fragment.setArguments(arguments);
                                        fragment.setHasOptionsMenu(true);
                                        getActivity().getSupportFragmentManager().beginTransaction()
                                                .replace(R.id.ProjectDetails, fragment).commit();
                                    } else {
                                        getActivity().finish();

                                        Intent detailIntent = new Intent(getActivity(),
                                                ProjectDetailsActivity.class);
                                        detailIntent.putExtra(ProjectDetailsFragment.PROJECTID,
                                                response.getInt("uuid"));
                                        detailIntent.putExtra(ProjectDetailsFragment.NAME,
                                                ProjectNameET.getText().toString());
                                        detailIntent.putExtra(ProjectDetailsFragment.SYNOPSIS,
                                                SynopsisET.getText().toString());
                                        detailIntent.putExtra(ProjectDetailsFragment.DESCRIPTION,
                                                DescET.getText().toString());
                                        detailIntent.putExtra(ProjectDetailsFragment.TECHNOLOGIES,
                                                TechET.getText().toString());
                                        detailIntent.putExtra(ProjectDetailsFragment.POPULARITY, 1);
                                        detailIntent.putExtra(ProjectDetailsFragment.TEAMMEMBERS,
                                                TeamMemberET.getText().toString());
                                        detailIntent.putExtra(ProjectDetailsFragment.ARG_2PANE, true);
                                        startActivity(detailIntent);
                                    }
                                } else {
                                    String error = "";
                                    if (response.has("error"))
                                        error = ": " + response.getString("error");

                                    Toast.makeText(getActivity(), "An Error Was encountered" + error,
                                            Toast.LENGTH_SHORT).show();
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                                Toast.makeText(getActivity(), "An Error Was encountered: " + e.getMessage(),
                                        Toast.LENGTH_SHORT).show();
                            }

                        }
                    }, new Response.ErrorListener() {

                        @Override
                        public void onErrorResponse(VolleyError error) {
                            // TODO Auto-generated method stub
                            Toast.makeText(getActivity(), "An Error Was encountered: " + error.getMessage(),
                                    Toast.LENGTH_SHORT).show();
                        }
                    });

            queue.add(jsObjRequest);
        }
    });
    return view;
}

From source file:com.xargsgrep.portknocker.activity.EditHostActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putInt(KEY_SELECTED_TAB_INDEX, getSupportActionBar().getSelectedNavigationIndex());
    outState.putBoolean(KEY_SHOW_CANCEL_DIALOG, (cancelDialog != null && cancelDialog.isShowing()));
}

From source file:com.tobbetu.en4s.navigationDrawer.ListActivity.java

private void selectItem(int position) {
    // update the main content by replacing fragments
    Fragment fragment = new ComplaintListFragment();
    Bundle args = new Bundle();
    args.putInt(ComplaintListFragment.ARG_COMPLAINT_NUMBER, position);
    fragment.setArguments(args);/*  w  ww  .java 2s.  c o  m*/

    FragmentManager fragmentManager = getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(TITLES[position]);
    mDrawerLayout.closeDrawer(relativeDrawerLayout);
}

From source file:com.njlabs.amrita.aid.info.Calender.java

@Override
public void init(Bundle savedInstanceState) {
    setupLayout(R.layout.activity_calender, Color.parseColor("#fe5352"));

    final Calender thisContext = this;

    descriptions = new HashMap<>();
    backgroundColors = new HashMap<>();
    textColors = new HashMap<>();

    SharedPreferences preferences = getSharedPreferences("app_extra", Context.MODE_PRIVATE);
    Boolean AgreeStatus = preferences.getBoolean("calender_agree", false);

    if (!AgreeStatus) {
        AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
        builder.setTitle("Academic Calender").setIcon(R.drawable.ic_action_info_small).setMessage(
                "Red denotes that it's an Exam day. Blue denotes an event (not a Holiday). Whereas Green denotes a Holiday. I'm not resposibile for the accuracy of the dates")
                .setCancelable(false).setPositiveButton("I Agree", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        SharedPreferences preferences = getSharedPreferences("app_extra", Context.MODE_PRIVATE);
                        SharedPreferences.Editor editor = preferences.edit();
                        editor.putBoolean("calender_agree", true);
                        editor.apply();//from  w ww  . ja  v  a 2s .  co m
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    }

    caldroidFragment = new CaldroidFragment();

    if (savedInstanceState != null) {
        caldroidFragment.restoreStatesFromKey(savedInstanceState, "CALDROID_SAVED_STATE");
    } else {
        Bundle args = new Bundle();
        Calendar cal = Calendar.getInstance();
        args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
        args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
        args.putBoolean(CaldroidFragment.ENABLE_SWIPE, true);
        caldroidFragment.setArguments(args);
    }

    setCustomResourceForDates();

    FragmentTransaction t = getSupportFragmentManager().beginTransaction();
    t.replace(R.id.calendar, caldroidFragment);
    t.commit();

    final CaldroidListener listener = new CaldroidListener() {
        @Override
        public void onSelectDate(Date date, View view) {
            if (!formatter.format(date).equals("")) {
                String description = descriptions.get(formatter.format(date));
                if (description != null && !description.equals("")) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(thisContext);
                    builder.setMessage(description).setCancelable(true).setPositiveButton("Close",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int id) {
                                    dialog.cancel();
                                }
                            });
                    AlertDialog alert = builder.create();
                    alert.show();
                }
            }
        }
    };
    caldroidFragment.setCaldroidListener(listener);
}

From source file:com.battlelancer.seriesguide.api.Action.java

/**
 * Serializes this {@link Action} object to a {@link android.os.Bundle} representation.
 *///  w  ww  .j a  v a2s  .co m
public Bundle toBundle() {
    Bundle bundle = new Bundle();
    bundle.putString(KEY_TITLE, mTitle);
    bundle.putString(KEY_VIEW_INTENT,
            (mViewIntent != null) ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null);
    bundle.putInt(KEY_ENTITY_IDENTIFIER, mEntityIdentifier);
    return bundle;
}

From source file:de.dmxcontrol.fragment.ActionSelectorFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putInt(EXTRA_PANEL_STATE, mState);
    super.onSaveInstanceState(outState);
}

From source file:com.nextgis.firereporter.HttpGetter.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    DismissDowloadDialog();/*  ww  w  .  ja  va  2  s  .  c om*/
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(GetFiresService.ERROR, true);
        bundle.putString(GetFiresService.ERR_MSG, mError);
        bundle.putInt(GetFiresService.SOURCE, mnType);

        Message msg = new Message();
        msg.setData(bundle);

        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    } else {
        //Toast.makeText(MainActivity.this, "Source: " + Content, Toast.LENGTH_LONG).show();
    }
}

From source file:com.nextgis.firereporter.ScanexHttpLogin.java

@Override
protected void onPostExecute(Void unused) {
    super.onPostExecute(unused);
    if (mbShowProgress) {
        mDownloadDialog.dismiss();//from   w w w . jav a 2s .  c o m
    }
    if (mError != null) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(GetFiresService.ERROR, true);
        bundle.putString(GetFiresService.ERR_MSG, mError);
        bundle.putInt(GetFiresService.SOURCE, mnType);

        Message msg = new Message();
        msg.setData(bundle);
        if (mEventReceiver != null) {
            mEventReceiver.sendMessage(msg);
        }
    }
}