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

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

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

FragmentActivity.getFilesDir介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

input = AndroidInputFactory.newAndroidInput(this, getActivity(), graphics.view, config);
audio = new AndroidAudio(getActivity(), config);
files = new AndroidFiles(getResources().getAssets(), getActivity().getFilesDir().getAbsolutePath());
net = new AndroidNet(this, config);
this.listener = listener;

代码示例来源:origin: libgdx/libgdx

input = AndroidInputFactory.newAndroidInput(this, getActivity(), graphics.view, config);
audio = new AndroidAudio(getActivity(), config);
files = new AndroidFiles(getResources().getAssets(), getActivity().getFilesDir().getAbsolutePath());
net = new AndroidNet(this, config);
this.listener = listener;

代码示例来源:origin: amahi/android

private File getOfflineFilePath(String name) {
  return new File(getActivity().getFilesDir() + "/" + Downloader.OFFLINE_PATH + "/" + name);
}

代码示例来源:origin: smarek/android-unbound-dns

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View v = inflater.inflate(R.layout.textview, container, false);
  mTextArea = (TextView) v.findViewById(R.id.textview);
  File logFile = new File(getActivity().getFilesDir(), getString(R.string.path_mainlog));
  mTailer = Tailer.create(logFile, this, 400, true);
  return v;
}

代码示例来源:origin: smarek/android-unbound-dns

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  View mView = inflater.inflate(R.layout.textarea, container, false);
  mTextArea = (TextView) mView.findViewById(R.id.textarea);
  mTextArea.clearFocus();
  try {
    BufferedReader br = new BufferedReader(new FileReader(new File(getActivity().getFilesDir(), "package/bin/unbound.conf")));
    String line;
    while ((line = br.readLine()) != null) {
      mTextArea.append(line);
      mTextArea.append("\n");
    }
  } catch (Throwable e) {
    e.printStackTrace();
  }
  return mView;
}

代码示例来源:origin: smarek/android-unbound-dns

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case MENU_SAVE:
      if (mTextArea == null) {
        break;
      }
      try {
        FileWriter fw = new FileWriter(new File(getActivity().getFilesDir(), getString(R.string.path_unbound_conf)), false);
        fw.write(mTextArea.getText().toString());
        fw.close();
        Toast.makeText(getActivity(), R.string.configuration_saved, Toast.LENGTH_LONG).show();
      } catch (IOException e) {
        Log.e(TAG, getString(R.string.error_cannot_write_unbound_conf), e);
      }
      return true;
  }
  return super.onOptionsItemSelected(item);
}

代码示例来源:origin: smarek/android-unbound-dns

@Override
public boolean onOptionsItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case MENU_EMPTY:
      try {
        FileWriter fw = new FileWriter(new File(getActivity().getFilesDir(), getString(R.string.path_mainlog)), false);
        fw.write("");
        fw.close();
        Toast.makeText(getActivity(), R.string.configuration_saved, Toast.LENGTH_LONG).show();
      } catch (IOException e) {
        Log.e(TAG, getString(R.string.error_cannot_write_unbound_conf), e);
      }
    case MENU_CLEAR:
      mTextArea.setText("");
      return true;
  }
  return super.onOptionsItemSelected(item);
}

代码示例来源:origin: AEFeinstein/mtg-familiar

/**
 * Save the current gathering with the given name
 *
 * @param _gatheringName The name of the gathering to save
 */
public void SaveGathering(String _gatheringName) {
  if (_gatheringName.length() <= 0) {
    SnackbarWrapper.makeAndShowText(getActivity(), R.string.gathering_toast_no_name, SnackbarWrapper.LENGTH_LONG);
    return;
  }
  mCurrentGatheringName = _gatheringName;
  int playersCount = mLinearLayout.getChildCount();
  ArrayList<GatheringsPlayerData> players = new ArrayList<>(playersCount);
  for (int idx = 0; idx < playersCount; idx++) {
    View player = mLinearLayout.getChildAt(idx);
    assert player != null;
    EditText customName = player.findViewById(R.id.custom_name);
    assert customName.getText() != null;
    String name = customName.getText().toString().trim();
    EditText startingLife = player.findViewById(R.id.starting_life);
    assert startingLife.getText() != null;
    int life = Integer.parseInt(startingLife.getText().toString());
    players.add(new GatheringsPlayerData(name, life));
  }
  GatheringsIO.writeGatheringXML(players, _gatheringName, mDisplayModeSpinner.getSelectedItemPosition(),
      getActivity().getFilesDir());
  getActivity().invalidateOptionsMenu();
}

代码示例来源:origin: wiglenet/wigle-wifi-wardriving

File kmlPath = new File(context.getFilesDir(), "app_kml");
if (!kmlPath.exists()) {
  kmlPath.mkdir();

代码示例来源:origin: AEFeinstein/mtg-familiar

if (GatheringsIO.getNumberOfGatherings(getActivity().getFilesDir()) <= 0 ||
    getFamiliarActivity() == null || !getFamiliarActivity().mIsMenuVisible) {
  deleteGathering.setVisible(false);

代码示例来源:origin: yoinx/kernel_adiutor

File sysfsdump = new File(getActivity().getFilesDir(), "sysfsdump.txt");
if (sysfsdump.exists()) {
  sysfsdump.delete();

代码示例来源:origin: amahi/android

private String getAudioPath() {
  return getActivity().getFilesDir() + "/" + Downloader.OFFLINE_PATH + "/" + getFile().getName();
}

代码示例来源:origin: AEFeinstein/mtg-familiar

File file = new File(getActivity().getFilesDir(), getArguments().getString(JudgesCornerFragment.HTML_DOC));
StringBuilder html = new StringBuilder();
BufferedReader reader = null;

代码示例来源:origin: AEFeinstein/mtg-familiar

GatheringsIO.getGatheringFileList(getActivity().getFilesDir());
            existingGatheringFile, getActivity().getFilesDir());
    .onPositive((dialog, which) -> {
      GatheringsIO.DeleteGatheringByName(getParentGatheringsFragment().mProposedGathering,
          getActivity().getFilesDir(), getActivity());
      getParentGatheringsFragment().SaveGathering(getParentGatheringsFragment().mProposedGathering);
    })
if (GatheringsIO.getNumberOfGatherings(getActivity().getFilesDir()) <= 0) {
  SnackbarWrapper.makeAndShowText(this.getActivity(), R.string.gathering_toast_no_gatherings,
      SnackbarWrapper.LENGTH_LONG);
ArrayList<String> dGatherings = GatheringsIO.getGatheringFileList(getActivity().getFilesDir());
final String[] dfGatherings = dGatherings.toArray(new String[dGatherings.size()]);
final String[] dProperNames = new String[dGatherings.size()];
for (int idx = 0; idx < dGatherings.size(); idx++) {
  dProperNames[idx] = GatheringsIO.ReadGatheringNameFromXML(dGatherings.get(idx),
      getActivity().getFilesDir());
    .items((CharSequence[]) dProperNames)
    .itemsCallback((dialog, itemView, position, text) -> {
      GatheringsIO.DeleteGathering(dfGatherings[position], getActivity().getFilesDir(),
          getActivity());
      getActivity().invalidateOptionsMenu();
if (GatheringsIO.getNumberOfGatherings(getActivity().getFilesDir()) <= 0) {
  SnackbarWrapper.makeAndShowText(this.getActivity(), R.string.gathering_toast_no_gatherings,

代码示例来源:origin: AEFeinstein/mtg-familiar

.items((CharSequence[]) tradeNames)
.itemsCallback((dialog, itemView, position, text) -> {
  File toDelete = new File(getActivity().getFilesDir(), tradeNames[position] +
      TradeFragment.TRADE_EXTENSION);
  if (!toDelete.delete()) {

代码示例来源:origin: AEFeinstein/mtg-familiar

.itemsCallback((dialog, itemView, position, text) -> {
  File toDelete = new File(getActivity().getFilesDir(),
      deckNames[position] + DecklistFragment.DECK_EXTENSION);
  if (!toDelete.delete()) {

代码示例来源:origin: AEFeinstein/mtg-familiar

if (GatheringsIO.getNumberOfGatherings(getActivity().getFilesDir()) <= 0) {
  SnackbarWrapper.makeAndShowText(this.getActivity(), R.string.gathering_toast_no_gatherings,
      SnackbarWrapper.LENGTH_LONG);
    .getGatheringFileList(getActivity().getFilesDir());
final String[] properNames = new String[gatherings.size()];
for (int idx = 0; idx < gatherings.size(); idx++) {
  properNames[idx] = GatheringsIO
      .ReadGatheringNameFromXML(gatherings.get(idx), getActivity().getFilesDir());
          .ReadGatheringXML(gatherings.get(position), getActivity().getFilesDir());

相关文章

微信公众号

最新文章

更多

FragmentActivity类方法