@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_main, container, false); AdView mAdView = (AdView) root.findViewById(R.id.adView); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a physical device. e.g. // "Use AdRequest.Builder.addTestDevice("ABCDEF012345") to get test ads on this device." AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .build(); mAdView.loadAd(adRequest); return root; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try{ DBHandler dbHandler = new DBHandler(getActivity()); liftNames = dbHandler.listAllTables(); DBHandler currentTable; int value; for(String liftName: liftNames){ currentTable = new DBHandler(getActivity(), liftName); currMaxes = currentTable.getAllItems(); value = MaxesAdapter.findLastValue(currentTable, liftName); if(value != -1){ MaxesCard newMax = new MaxesCard(createTitle(liftName), value); list.add(newMax); } } dbHandler.close(); } catch (Exception e){ } }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Toolbar toolbar = (Toolbar) findViewById(R.id.activity_home_toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(R.string.activity_home_toolbar_title); mViewpager = (ViewPager) findViewById(R.id.activity_home_viewpager); mTabLayout = (TabLayout) findViewById(R.id.activity_home_tab_layout); mFab = (FloatingActionButton) findViewById(R.id.activity_home_fab); mFab.setOnClickListener(this); setupViewPagerAndTabLayout(); //startNotificationService(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recycler_view); datas = new ArrayList<>(); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setAdapter(mAdapter = new HomeAdapter()); getCategoryData(); getCategoryData(); getCategoryData(); mAdapter.notifyDataSetChanged(); }
public void setupServiceReceiver() { mReceiver = new DownloadResultReceiver(new Handler()); Intent intent = new Intent(getApplicationContext(), DownloadService.class); intent.putExtra("receiver", mReceiver); if(!PreferenceHelper.isSynced(getApplicationContext())) { startService(intent); } // This is where we specify what happens when data is received from the // service mReceiver.setReceiver(new DownloadResultReceiver.Receiver() { @Override public void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == RESULT_OK) { String resultValue = resultData.getString("resultValue"); Toast.makeText(MainActivity.this, resultValue, Toast.LENGTH_SHORT).show(); } } }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_modos_russa); botaoVoltar = (Button) findViewById(R.id.botaoVoltarRussa_6); botaoVoltar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ModosRussaActivity.this, RussaActivity.class); startActivity(intent); finish(); } }); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == OVERLAY_PERMISSION_REQ_CODE) { if (Build.VERSION.SDK_INT >= 23 && !Settings.canDrawOverlays(this)) { //SYSTEM_ALERT_WINDOW permission not granted... Toast.makeText(this, "Permission Denied by user.", Toast.LENGTH_SHORT) .show(); mSwSms.setChecked(false); ShareUtil.putBoolean(this, "isSms", mSwSms.isChecked()); } else { Toast.makeText(this, "Permission allowed", Toast.LENGTH_SHORT).show(); mSwSms.setChecked(true); ShareUtil.putBoolean(this, "isSms", mSwSms.isChecked()); } } else if (requestCode == QRCODE_RESULT) { if (resultCode == RESULT_OK) { Bundle bundle = data.getExtras(); String scanResult = bundle.getString("result"); mScanResult.setText(scanResult); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) // .setAction("Action", null).show(); showActionSheet(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); }
/** * Persists all supported data types present in the passed in Bundle, to the * cache * * @param bundle * The Bundle containing information to be cached */ public void save(Bundle bundle) { Validate.notNull(bundle, "bundle"); SharedPreferences.Editor editor = cache.edit(); for (String key : bundle.keySet()) { try { serializeKey(key, bundle, editor); } catch (JSONException e) { // Error in the bundle. Don't store a partial cache. Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "Error processing value for key: '" + key + "' -- " + e); // Bypass the commit and just return. This cancels the entire edit transaction return; } } boolean successfulCommit = editor.commit(); if (!successfulCommit) { Logger.log(LoggingBehavior.CACHE, Log.WARN, TAG, "SharedPreferences.Editor.commit() was not successful"); } }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_click, container, false); if (null != savedInstanceState) { mClickCounter = savedInstanceState.getParcelable(CLICK_COUNT_TAG); } else { mClickCounter = new ClickCounter(); } mTextView = (TextView) rootView.findViewById(R.id.click_count_text_view); displayClickCount(); Button button = (Button) rootView.findViewById(R.id.click_button); button.setOnClickListener(mListener); return rootView; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_exit, container, false); mSharedPreferences = getActivity().getSharedPreferences( "org.greenstand.android", Context.MODE_PRIVATE); Button yesBtn = (Button) v.findViewById(R.id.fragment_exit_yes); yesBtn.setOnClickListener(ExitFragment.this); Button noBtn = (Button) v.findViewById(R.id.fragment_exit_no); noBtn.setOnClickListener(ExitFragment.this); return v; }
@Override public void writeToParcel(final Parcel parcel, final int arg1) { final Bundle b = new Bundle(getClass().getClassLoader()); b.putByteArray(PARCEL_EXTRA_DEVICE_SCANRECORD, mScanRecord); b.putInt(PARCEL_EXTRA_FIRST_RSSI, mFirstRssi); b.putInt(PARCEL_EXTRA_CURRENT_RSSI, mCurrentRssi); b.putLong(PARCEL_EXTRA_FIRST_TIMESTAMP, mFirstTimestamp); b.putLong(PARCEL_EXTRA_CURRENT_TIMESTAMP, mCurrentTimestamp); b.putParcelable(PARCEL_EXTRA_BLUETOOTH_DEVICE, mDevice); b.putParcelable(PARCEL_EXTRA_DEVICE_SCANRECORD_STORE, mRecordStore); b.putSerializable(PARCEL_EXTRA_DEVICE_RSSI_LOG, (Serializable) mRssiLog); parcel.writeBundle(b); }
@Override @SuppressLint("NewApi") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // External storage permissions if (Build.VERSION.SDK_INT < 23) { Log.d(TAG, "Don't need permissions."); } else { if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (shouldShowRequestPermissionRationale(Manifest.permission.READ_EXTERNAL_STORAGE)) { Log.d(TAG, "PERMISSIONS: App needs permissions to read external storage."); } requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE); } } // Create directory for files if it does not exist File musicFolder = new File(Environment.getExternalStorageDirectory() + File.separator + MUSIC_DIR_NAME); if (!musicFolder.exists()) { musicFolder.mkdir(); } // Get shared prefs sharedPreferences = getSharedPreferences("com.lunchareas.divertio", MODE_PRIVATE); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_b); mActivityName = getString(R.string.activity_b_label); mStatusView = (TextView)findViewById(R.id.status_view_b); mStatusAllView = (TextView)findViewById(R.id.status_view_all_b); mStatusTracker.setStatus(mActivityName, getString(R.string.on_create)); Utils.printStatus(mStatusView, mStatusAllView); }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dream); StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary)); lvDream = forceCast(findViewById(R.id.lvDream)); etDream = forceCast(findViewById(R.id.etDream)); etDream.setText(R.string.dream_api_example); findViewById(R.id.btnSearch).setOnClickListener(this); dreamList = new ArrayList<HashMap<String,Object>>(); adapter = new DreamSimpleAdapter(this, dreamList); lvDream.setAdapter(adapter); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); jobManager = RemoteApplication.getInstance().getJobManager(); data = new ArrayList<>(); initViews(); AppRater.app_launched(this); connectionSetup(); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_file_infos, container, false); RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.recycler_view_file_infos); recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setAdapter(mAdapter); recyclerView.hasFixedSize(); return root; }
@Override public void invoke(Bundle data, IPCRemoteInvokeCallback<Bundle> callback) { XIPCDispatcherImpl dispatcher = new XIPCDispatcherImpl(); IPCString event = new IPCString(); event.value = String.format("current process name : %s, task : %s, pid : %s, time : %s", IPCInvokeLogic.getCurrentProcessName(), hashCode(), android.os.Process.myPid(), System.currentTimeMillis()); dispatcher.dispatch(event); Log.i(TAG, "publish event(%s)", event.value); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); }
/** * Like {@link #startActivityFromChild(Activity, Intent, int)}, but * taking a IntentSender; see * {@link #startIntentSenderForResult(IntentSender, int, Intent, int, int, int)} * for more information. */ public void startIntentSenderFromChild(Activity child, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, @Nullable Bundle options) throws IntentSender.SendIntentException { startIntentSenderForResultInner(intent, child.mEmbeddedID, requestCode, fillInIntent, flagsMask, flagsValues, options); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { //初始化百度地图SDK SDKInitializer.initialize(WzyxApplication.getContext()); View view = inflater.inflate(R.layout.fragment_near, container, false); mUnbinder = ButterKnife.bind(this, view); return view; }
@Override public IPresenterFactory<ChatAttachmentVideoPresenter> getPresenterFactory(@Nullable Bundle saveInstanceState) { return () -> { int accountId = getArguments().getInt(Extra.ACCOUNT_ID); int peerId = getArguments().getInt(Extra.PEER_ID); return new ChatAttachmentVideoPresenter(peerId, accountId, saveInstanceState); }; }
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); BoxingConfig config; if (savedInstanceState != null) { config = savedInstanceState.getParcelable(Boxing.EXTRA_CONFIG); } else { config = BoxingManager.getInstance().getBoxingConfig(); } setPickerConfig(config); parseSelectedMedias(savedInstanceState, getIntent()); setPresenter(new PickerPresenter(this)); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContentView = LayoutInflater.from(this).inflate(getLayoutId(), null); setContentView(mContentView); initPresenter(); initViews(); initData(getIntent()); requestData(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); mDrawerLayout.addView(inflater.inflate(R.layout.activity_settings, null)); Button applySettings = (Button) findViewById(R.id.apply_settings); applySettings.setOnClickListener(this); updateUi(); }
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { L.v(TAG, " MyDownloadingFragment onCreateView"); this.myDownloadActivity = (MyDownloadActivity) getActivity(); this.mBaseBatchDelActivity = (BaseBatchDelActivity) getActivity(); this.mView = getActivity().getLayoutInflater().inflate(R.layout.fragment_my_download_template, null); initView(); this.myDownloadActivity.showDownloadingNum(this.mDownloadAdapter.getCount()); super.onCreateView(inflater, container, savedInstanceState); return this.mView; }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); this.listView = (ListView) this.mPullRefreshListView.getRefreshableView(); this.mAddFoodListAdapter = new CommonFoodListAdapter(getActivity(), this.mFoodList); this.listView.setAdapter(this.mAddFoodListAdapter); this.mPullRefreshListView.setOnRefreshListener(new OnRefreshListener<ListView>() { public void onRefresh(PullToRefreshBase<ListView> pullToRefreshBase) { CommonFoodFragmennt.this.mPage = 1; CommonFoodFragmennt.this.mCurrentPage = CommonFoodFragmennt.this.mPage; CommonFoodFragmennt.this.hasMore = true; CommonFoodFragmennt.this.loadData(); } }); this.mPullRefreshListView.setOnLastItemVisibleListener(new OnLastItemVisibleListener() { public void onLastItemVisible() { if (CommonFoodFragmennt.this.mPage > CommonFoodFragmennt.this.mCurrentPage) { CommonFoodFragmennt.this.mCurrentPage = CommonFoodFragmennt.this.mPage; CommonFoodFragmennt.this.loadData(); } } }); this.listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { if (CommonFoodFragmennt.this.mFoodList != null && CommonFoodFragmennt.this .mFoodList.size() != 0 && position >= 1 && CommonFoodFragmennt.this .isAdded() && !CommonFoodFragmennt.this.isDetached()) { AddDietFragment.newInstance(CommonFoodFragmennt.this.mTimeType, CommonFoodFragmennt.this.record_on, ((CommonFood) CommonFoodFragmennt .this.mFoodList.get(position - 1)).code).show (CommonFoodFragmennt.this.getChildFragmentManager(), "addDietFragment"); } } }); refreshData(this.mCache.getAsJSONObject(CacheKey.COMMON_FOOD)); firstLoad(); }
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_first); init(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mContext = this; showBackNavigate(true); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { Uri uri = TaskItemsContract.TaskItemsColumns.CONTENT_URI; uri = uri.buildUpon().appendPath(String.valueOf(itemId)).build(); Cursor cursor = getActivity().getContentResolver().query(uri, null, null, null, null); if (cursor.moveToNext()) { int titleIndex = cursor.getColumnIndex(TaskItemsContract.TaskItemsColumns.COLUMN_NAME_DESCRIPTION); int itemDescriptionIndex = cursor.getColumnIndex(TaskItemsContract.TaskItemsColumns.COLUMN_NAME_COMPLETED_DATES); int colorIndex = cursor.getColumnIndex(TaskItemsContract.TaskItemsColumns.COLUMN_NAME_COLOR); int finishedIndex = cursor.getColumnIndex(TaskItemsContract.TaskItemsColumns.COLUMN_NAME_IS_FINISHED); String dates = cursor.getString(itemDescriptionIndex); try { JSONObject jsonObject = new JSONObject(dates); JSONArray jsonArray = jsonObject.optJSONArray(UpdateProgressTasks.UNIQUE_DAYS_KEY); HashSet<Date> events = new HashSet<Date>(); if (1 == cursor.getInt(finishedIndex)) { events.add(new Date()); } if (null != jsonArray) { for (int i = 0; i < jsonArray.length(); i++) { events.add(new Date(jsonArray.getLong(i))); } } mTitleTextView.setText(cursor.getString(titleIndex)); mTitleTextView.setTextColor(cursor.getInt(colorIndex)); mCalendarView.updateCalendar(events); mCalendarView.setBackgroundColor(cursor.getInt(colorIndex)); } catch (JSONException e) { e.printStackTrace(); } } cursor.close(); super.onViewCreated(view, savedInstanceState); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login_success); Explode explode = new Explode(); explode.setDuration(500); getWindow().setExitTransition(explode); getWindow().setEnterTransition(explode); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_order_product, container, false); unbinder = ButterKnife.bind(this, view); return view; }
@Override public void logProcessingTime(SortingMode sortingMode, double processingTime) { Bundle bundle = new Bundle(); // bundle.putString(getString(R.string.param_sorting_mode), sortingMode.toString()); bundle.putString(FirebaseAnalytics.Param.VALUE, sortingMode.toString()); bundle.putDouble(FirebaseAnalytics.Param.VALUE, processingTime); FirebaseAnalytics.getInstance(getApplicationContext()).logEvent(getString(R.string.event_processing_time), bundle); }
/** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param networkId Network ID * @param stationId Station ID * @return A new instance of fragment StationLobbyFragment. */ public static StationLobbyFragment newInstance(String networkId, String stationId) { StationLobbyFragment fragment = new StationLobbyFragment(); Bundle args = new Bundle(); args.putString(ARG_NETWORK_ID, networkId); args.putString(ARG_STATION_ID, stationId); fragment.setArguments(args); return fragment; }
/** * 获取其他应用组件的意图 * * @param packageName 包名 * @param className 全类名 * @param bundle bundle * @return intent */ public static Intent getComponentIntent(String packageName, String className, Bundle bundle) { Intent intent = new Intent(Intent.ACTION_VIEW); if (bundle != null) { intent.putExtras(bundle); } ComponentName cn = new ComponentName(packageName, className); intent.setComponent(cn); return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getActivity().setRequestedOrientation(SCREEN_ORIENTATION_NOSENSOR); cameraView.setPreviewConsumer(new QrCodeDecoder(this)); }
@Override public void initData(Bundle savedInstanceState) { mHeadView.setTitle("交易记录"); fragmentManager = getSupportFragmentManager(); transaction = fragmentManager.beginTransaction(); accountFragment = new AccountFragment(); transaction.replace(R.id.content, accountFragment); transaction.commit(); }
@Override public void onSaveInstanceState(Bundle outState) { if ((keepPresenterDuringScreenOrientationChange || keepPresenterOnBackstack) && outState != null) { outState.putString(KEY_MOSBY_VIEW_ID, mosbyViewId); if (DEBUG) { Log.d(DEBUG_TAG, "Saving MosbyViewId into Bundle. ViewId: " + mosbyViewId); } } }
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = c.get(Calendar.DAY_OF_MONTH); // Create a new instance of DatePickerDialog and return it return new DatePickerDialog(getActivity(), this, year, month, day); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_quiz_page, container, false); View headerview = ((LayoutInflater) getActivity().getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE)) .inflate(R.layout.item_list_header_view, null, false); ((TextView) headerview.findViewById(android.R.id.title)).setText(mPage.getQuestionText()); final ListView listView = (ListView) rootView.findViewById(android.R.id.list); listView.addHeaderView(headerview); setListAdapter(new ArrayAdapter<String>(getActivity(), R.layout.item_answer, android.R.id.text1, mChoices)); listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // Pre-select currently selected item. new Handler().post(new Runnable() { @Override public void run() { String selection = mPage.getData().getString(QuizPage.DATA_KEY); for (int i = 0; i < mChoices.size(); i++) { if (mChoices.get(i).equals(selection)) { listView.setItemChecked(i+1, true); // a simple hack break; } } } }); return rootView; }