android.support.v4.app.FragmentActivity.getBaseContext()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中android.support.v4.app.FragmentActivity.getBaseContext()方法的一些代码示例,展示了FragmentActivity.getBaseContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FragmentActivity.getBaseContext()方法的具体详情如下:
包路径:android.support.v4.app.FragmentActivity
类名称:FragmentActivity
方法名:getBaseContext

FragmentActivity.getBaseContext介绍

暂无

代码示例

代码示例来源:origin: ukanth/afwall

@Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    
    TextView text = (TextView) getActivity().findViewById(R.id.faq_afwall_title);
    text.setText(R.string.faq);
    
    WebView creditsWebView = (WebView) getActivity().findViewById(R.id.faq_webview);
    try {
      String data = Api.loadData(getActivity().getBaseContext(), "faq");
      creditsWebView.loadDataWithBaseURL(null, data, "text/html","UTF-8",null);
    } catch (IOException ioe) {
      Log.e(TAG, "Error reading changelog file!", ioe);
    }
  }        
}

代码示例来源:origin: ukanth/afwall

@Override
public void onActivityCreated(Bundle savedInstanceState) {
  super.onActivityCreated(savedInstanceState);
  String version = BuildConfig.VERSION_NAME;
  TextView text = (TextView) getActivity().findViewById(R.id.afwall_title);
  String versionText = getString(R.string.app_name) + " (v" + version + ")";
  if(G.isDoKey(getActivity().getApplicationContext()) || BuildConfig.APPLICATION_ID.equals("dev.ukanth.ufirewall.donate")) {
    versionText = versionText + " (Donate) " +  getActivity().getString(R.string.donate_thanks)+  ":)";
  }
  text.setText(versionText);
  
  WebView creditsWebView = (WebView) getActivity().findViewById(R.id.about_thirdsparty_credits);
  try {
    String data = Api.loadData(getActivity().getBaseContext(), "about");
    creditsWebView.loadDataWithBaseURL(null, data, "text/html","UTF-8",null);
  } catch (IOException ioe) {
    Log.e(Api.TAG, "Error reading changelog file!", ioe);
  }
}

代码示例来源:origin: Suleiman19/Android-Material-Design-for-pre-Lollipop

@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dummy_fragment, container, false);
    final FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.dummyfrag_bg);
    frameLayout.setBackgroundColor(color);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.dummyfrag_scrollableview);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity().getBaseContext());
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setHasFixedSize(true);
    DessertAdapter adapter = new DessertAdapter(getContext());
    recyclerView.setAdapter(adapter);
    return view;
  }
}

代码示例来源:origin: Suleiman19/Android-Material-Design-for-pre-Lollipop

@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dummy_fragment, container, false);
    final FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.dummyfrag_bg);
    frameLayout.setBackgroundColor(color);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.dummyfrag_scrollableview);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity().getBaseContext());
    recyclerView.setLayoutManager(linearLayoutManager);
    recyclerView.setHasFixedSize(true);
    List<String> list = new ArrayList<String>();
    for (int i = 0; i < VersionModel.data.length; i++) {
      list.add(VersionModel.data[i]);
    }
    adapter = new SimpleRecyclerAdapter(list);
    recyclerView.setAdapter(adapter);
    return view;
  }
}

代码示例来源:origin: pushpalroy/GooglePlayCloned

private void configureMainRecyclerView() {
  mRecyclerView = view.findViewById(R.id.rv_top_app_list);
  mRecyclerView.setHasFixedSize(true);
  RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
  mRecyclerView.setLayoutManager(layoutManager);
  DividerItemDecoration divider = new
      DividerItemDecoration(mRecyclerView.getContext(),
      DividerItemDecoration.VERTICAL);
  divider.setDrawable(Objects.requireNonNull(ContextCompat.getDrawable(Objects.requireNonNull(getActivity()).getBaseContext(),
      R.drawable.line_divider)));
  mRecyclerView.addItemDecoration(divider);
  loadAdapterData();
}

代码示例来源:origin: CesarValiente/PermissionsSample

private void setupList() {
  recyclerView.setHasFixedSize(true);
  layoutManager = new LinearLayoutManager(getActivity().getBaseContext());
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.addOnItemTouchListener(
      new ItemClickListener(getActivity(), new ItemClickListener.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
          showContactFragment(contactList.get(position));
        }
      }));
}

代码示例来源:origin: openbmap/radiocells-scanner-android

@Override
public final Loader<Cursor> onCreateLoader(final int arg0, final Bundle arg1) {
  final String[] projection = {
      Schema.COL_ID,
      Schema.COL_CREATED_AT,
      Schema.COL_IS_ACTIVE,
      Schema.COL_HAS_BEEN_EXPORTED,
      Schema.COL_NUMBER_OF_CELLS,
      Schema.COL_NUMBER_OF_WIFIS,
      Schema.COL_NUMBER_OF_WAYPOINTS
  };
  return new CursorLoader(getActivity().getBaseContext(),
      ContentProvider.CONTENT_URI_SESSION, projection, null, null, Schema.COL_CREATED_AT + " DESC");
}

代码示例来源:origin: openbmap/radiocells-scanner-android

@Override
public final Loader<Cursor> onCreateLoader(final int arg0, final Bundle arg1) {
  // set query params: bssid and session id
  final String[] args = {"-1", String.valueOf(RadioBeacon.SESSION_NOT_TRACKING)};
  if (mWifi != null) {
    args[0] = mWifi.getBssid();
  }
  final DataHelper dbHelper = new DataHelper(this.getActivity());
  args[1] = String.valueOf(dbHelper.getActiveSessionId());
  final String[] projection = { Schema.COL_ID, Schema.COL_SSID, Schema.COL_LEVEL,  "begin_" + Schema.COL_LATITUDE, "begin_" + Schema.COL_LONGITUDE};
  return new CursorLoader(getActivity().getBaseContext(),  ContentProvider.CONTENT_URI_WIFI_EXTENDED,
          projection, Schema.COL_BSSID + " = ? AND " + Schema.COL_SESSION_ID + " = ?", args, Schema.COL_LEVEL + " ASC");
}

代码示例来源:origin: hiteshsahu/ECommerce-App-Android

getActivity().getBaseContext());
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setHasFixedSize(true);

代码示例来源:origin: marzika/Snapprefs

container, false);
context = container.getContext();
final TelephonyManager tm = (TelephonyManager) getActivity().getBaseContext().getSystemService(Context.TELEPHONY_SERVICE);

代码示例来源:origin: openbmap/radiocells-scanner-android

return new CursorLoader(getActivity().getBaseContext(),
    ContentProvider.CONTENT_URI_CELL_EXTENDED, projection, selectSql, args.toArray(new String[args.size()]), Schema.COL_STRENGTHDBM + " DESC");

代码示例来源:origin: hiteshsahu/ECommerce-App-Android

getActivity().getBaseContext());

代码示例来源:origin: othreecodes/Quicksend

private MaterialDialog Authenticate(final Template template, final List<Company> companies) {
  LayoutInflater inflater = (LayoutInflater) getActivity().getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  final View v = inflater.inflate(R.layout.content_login, null);
  EditText nameEditText = (EditText) v.findViewById(R.id.input_email);
  nameEditText.setText(preferences.getString("email", ""));
  return new MaterialDialog.Builder(getActivity())
      .title("Authentication Required")
      .customView(v, true)
      .positiveText("Authenticate")
      .theme(Theme.DARK)
      .negativeText(R.string.cancel)
      .onPositive(new MaterialDialog.SingleButtonCallback() {
        @Override
        public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
          EditText nameEditText = (EditText) v.findViewById(R.id.input_email);
          EditText email = (EditText) v.findViewById(R.id.input_password);
          nameEditText.clearFocus();
          email.clearFocus();
          username = nameEditText.getText().toString();
          password = email.getText().toString();
          preferences.edit().putString("email", username).apply();
          for (Company company : companies) {
            new SendEmail(template, username, password, company).execute();
          }
          Toast.makeText(getContext(), "Emails will be sent in the background, " +
              "Check Statusbar for progress", Toast.LENGTH_LONG)
              .show();
        }
      }).show();
}

代码示例来源:origin: othreecodes/Quicksend

@Override
  public void onClick(View view) {
    LayoutInflater inflater = (LayoutInflater) getActivity().getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View v = inflater.inflate(R.layout.add_company, null);
    EditText email = (EditText) v.findViewById(R.id.input_email);
    email.setText(dataEmail);
    new MaterialDialog.Builder(getActivity())
        .title("Add Company")
        .customView(v, true)
        .positiveText(R.string.add)
        .theme(Theme.LIGHT)
        .negativeText(R.string.cancel)
        .onPositive(new MaterialDialog.SingleButtonCallback() {
          @Override
          public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
            EditText nameEditText = (EditText) v.findViewById(R.id.input_name);
            EditText email = (EditText) v.findViewById(R.id.input_email);
            nameEditText.clearFocus();
            email.clearFocus();
            Company company = new Company();
            company.setEmailAddress(email.getText().toString());
            company.setCompanyName(nameEditText.getText().toString());
            companies.add(company);
            companyAdapter.notifyDataSetChanged();
            dataEmail = null;
            storage.saveAll(getContext(), companies);
          }
        }).show();
  }
};

代码示例来源:origin: seemoo-lab/fitness-app

/**
 * Connects the app with the device.
 */
public void connect() {
  FitbitDevice.setMacAddress(device.getAddress());
  BluetoothGatt mBluetoothGatt = device.connectGatt(getActivity().getBaseContext(), false, mBluetoothGattCallback);
  commands = new Commands(mBluetoothGatt);
  interactions = new Interactions(this, toast_short, commands);
  tasks = new Tasks(interactions, this);
}

代码示例来源:origin: othreecodes/Quicksend

@Override
  public void onClick(View view) {
    LayoutInflater inflater = (LayoutInflater) getActivity().getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View v = inflater.inflate(R.layout.add_template, null);
    new MaterialDialog.Builder(getActivity())
        .title("Add Mail Template")
        .customView(v, true)
        .positiveText(R.string.add)
        .theme(Theme.LIGHT)
        .negativeText(R.string.cancel)
        .onPositive(new MaterialDialog.SingleButtonCallback() {
          @Override
          public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
            EditText subjectEditText = (EditText) v.findViewById(R.id.input_subject);
            EditText bodyEditText = (EditText) v.findViewById(R.id.input_text);
            subjectEditText.clearFocus();
            bodyEditText.clearFocus();
            Template template = new Template();
            template.setSubject(subjectEditText.getText().toString());
            template.setMessage(bodyEditText.getText().toString());
            templates.add(template);
            templateAdapter.notifyDataSetChanged();
            storage.saveAll(getContext(), templates);
          }
        }).show();
  }
};

代码示例来源:origin: openbmap/radiocells-scanner-android

};
mAdapter = new SimpleCursorAdapter(getActivity().getBaseContext(),
    R.layout.sessionlistfragment, null, from, to, 0);
mAdapter.setViewBinder(new SessionViewBinder());

相关文章

微信公众号

最新文章

更多

FragmentActivity类方法