List of usage examples for android.os Bundle putSerializable
@Override public void putSerializable(@Nullable String key, @Nullable Serializable value)
From source file:com.grayfox.android.app.fragment.UserProfileFragment.java
public static UserProfileFragment newInstance(User user) { UserProfileFragment fragment = new UserProfileFragment(); Bundle args = new Bundle(); args.putSerializable(USER_ARG, user); fragment.setArguments(args);// w w w . java 2 s .c o m return fragment; }
From source file:org.c99.SyncProviderDemo.ContactsSyncAdapterService.java
private static void generateNotification(Noticia noticia, Context context) { NotificationManager mNotificationManager; int numMessages = 0; Log.i("Start", "notification"); /* Invoking the default notification service */ NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context); mBuilder.setContentTitle("Nova noticia"); mBuilder.setContentText(noticia.getAssunto()); mBuilder.setTicker("Noticia !!!"); mBuilder.setSmallIcon(R.drawable.logo); /* Increase notification number every time a new notification arrives */ mBuilder.setNumber(++numMessages);//w w w . j av a 2s. c o m /* Creates an explicit intent for an Activity in your app */ Intent resultIntent = new Intent(context, NavigationDrawer.class); resultIntent.setAction("NOTICIA"); //tentando linkar Bundle bundle = new Bundle(); bundle.putSerializable("noticia", noticia); resultIntent.putExtras(bundle); // fim arrumar a inteao TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(NavigationDrawer.class); /* Adds the Intent that starts the Activity to the top of the stack */ stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mNotificationManager = // (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // (NotificationManager) getActivity().getApplication(). // getSystemService(getActivity().getApplication().NOTIFICATION_SERVICE); // (NotificationManager) getContext().getSystemService(getContext().NOTIFICATION_SERVICE); // (NotificationManager) getSystemService(NOTIFICATION_SERVICE); (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); /* notificationID allows you to update the notification later on. */ mNotificationManager.notify(noticia.getCodigo(), mBuilder.build()); }
From source file:org.c99.SyncProviderDemo.EventosSyncAdapterService.java
private static void generateNotification(Evento evento, Context context) { NotificationManager mNotificationManager; int numMessages = 0; Log.i("Start", "notification"); /* Invoking the default notification service */ NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context); mBuilder.setContentTitle("Novo evento"); mBuilder.setContentText(evento.getNome()); mBuilder.setTicker("Evento !!!"); mBuilder.setSmallIcon(R.drawable.logo); /* Increase notification number every time a new notification arrives */ mBuilder.setNumber(++numMessages);/*from ww w. j av a 2 s .co m*/ /* Creates an explicit intent for an Activity in your app */ Intent resultIntent = new Intent(context, NavigationDrawer.class); resultIntent.setAction("EVENTO"); //tentando linkar Bundle bundle = new Bundle(); bundle.putSerializable("evento", evento); resultIntent.putExtras(bundle); // fim arrumar a inteao TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(NavigationDrawer.class); /* Adds the Intent that starts the Activity to the top of the stack */ stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(resultPendingIntent); mNotificationManager = // (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // (NotificationManager) getActivity().getApplication(). // getSystemService(getActivity().getApplication().NOTIFICATION_SERVICE); /* notificationID allows you to update the notification later on. */ // (NotificationManager) getApplication().getSystemService(NOTIFICATION_SERVICE); (NotificationManager) context.getSystemService(NOTIFICATION_SERVICE); mNotificationManager.notify(evento.getCodigo(), mBuilder.build()); }
From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingFragment.java
/** * Add a new {@link MeetingFragment} to the given {@link FragmentManager}, for the given meeting. */// w ww . j a va2 s. c o m public static void startMeeting(FragmentManager fragmentManager, Meeting meeting) { Bundle bundle = new Bundle(1); bundle.putLong(Meetings.EXTRA_MEETING_ID, meeting.getId()); bundle.putSerializable(Meetings.EXTRA_MEETING_STATE, meeting.getState()); MeetingFragment meetingFragment = new MeetingFragment(); meetingFragment.setArguments(bundle); fragmentManager.beginTransaction().replace(R.id.meeting_fragment_placeholder, meetingFragment).commit(); }
From source file:biz.wiz.android.wallet.ui.TransactionsListFragment.java
public static TransactionsListFragment instance(@Nullable final Direction direction) { final TransactionsListFragment fragment = new TransactionsListFragment(); final Bundle args = new Bundle(); args.putSerializable(KEY_DIRECTION, direction); fragment.setArguments(args);/* w ww .ja va 2 s. co m*/ return fragment; }
From source file:com.fullpower.changeit.fragments.InstagramFragment.java
public static InstagramFragment newInstance(int numberOfColums, int pos) { Bundle args = new Bundle(); if (args != null) { args.putSerializable(ARG_NUM_COL, mList[pos]); args.putSerializable(ARG_FRAGMENT_POS, pos); }//from ww w . j a v a2 s.c om InstagramFragment fragment = new InstagramFragment(); fragment.setArguments(args); return fragment; }
From source file:it.gulch.linuxday.android.fragments.EventDetailsFragment.java
public static EventDetailsFragment newInstance(Event event) { EventDetailsFragment f = new EventDetailsFragment(); Bundle args = new Bundle(); args.putSerializable(ARG_EVENT, event); f.setArguments(args);/* w w w . j av a 2s. c o m*/ return f; }
From source file:com.examples.abelanav2.ui.PicturesFragment.java
/** * Use this factory method to create a new instance of * this fragment using the provided parameters. * @param pFragmentType the type of pictures list for this fragment. * @return A new instance of fragment PicturesFragment.BackendConstants *///w ww. jav a 2 s .co m public static PicturesFragment newInstance(AbelanaClient.PhotoListType pFragmentType) { PicturesFragment fragment = new PicturesFragment(); Bundle args = new Bundle(); args.putSerializable(ARG_FRAGMENT_TYPE, pFragmentType); fragment.setArguments(args); return fragment; }
From source file:com.nextgis.mobile.map.RemoteTMSLayer.java
protected static void create(final MapBase map, String layerName, String layerUrl, int tmsType) { String sErr = map.getContext().getString(R.string.error_occurred); try {// ww w . j a v a 2 s . c o m File outputPath = map.cretateLayerStorage(); //create layer description file JSONObject oJSONRoot = new JSONObject(); oJSONRoot.put(JSON_NAME_KEY, layerName); oJSONRoot.put(JSON_URL_KEY, layerUrl); oJSONRoot.put(JSON_VISIBILITY_KEY, true); oJSONRoot.put(JSON_TYPE_KEY, LAYERTYPE_TMS); oJSONRoot.put(JSON_TMSTYPE_KEY, tmsType); //send message to handler to show error or add new layer File file = new File(outputPath, LAYER_CONFIG); FileUtil.createDir(outputPath); FileUtil.writeToFile(file, oJSONRoot.toString()); if (map.getMapEventsHandler() != null) { Bundle bundle = new Bundle(); bundle.putBoolean(BUNDLE_HASERROR_KEY, false); bundle.putString(BUNDLE_MSG_KEY, map.getContext().getString(R.string.message_layer_added)); bundle.putInt(BUNDLE_TYPE_KEY, MSGTYPE_LAYER_ADDED); bundle.putSerializable(BUNDLE_PATH_KEY, outputPath); Message msg = new Message(); msg.setData(bundle); map.getMapEventsHandler().sendMessage(msg); } return; } catch (FileNotFoundException e) { Log.d(TAG, "Exception: " + e.getLocalizedMessage()); sErr += ": " + e.getLocalizedMessage(); } catch (JSONException e) { Log.d(TAG, "Exception: " + e.getLocalizedMessage()); sErr += ": " + e.getLocalizedMessage(); } catch (IOException e) { Log.d(TAG, "Exception: " + e.getLocalizedMessage()); sErr += ": " + e.getLocalizedMessage(); } //if we here something wrong occurred Toast.makeText(map.getContext(), sErr, Toast.LENGTH_SHORT).show(); }
From source file:butter.droid.fragments.MediaListFragment.java
public static MediaListFragment newInstance(Mode mode, MediaProvider provider, MediaProvider.Filters.Sort filter, MediaProvider.Filters.Order defOrder, String genre) { MediaListFragment frag = new MediaListFragment(); Bundle args = new Bundle(); args.putParcelable(EXTRA_PROVIDER, provider); args.putSerializable(EXTRA_MODE, mode); args.putSerializable(EXTRA_SORT, filter); args.putSerializable(EXTRA_ORDER, defOrder); args.putString(EXTRA_GENRE, genre);/* w ww . j av a2s. c o m*/ frag.setArguments(args); return frag; }