android.os.Bundle.getCharSequence()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(156)

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

Bundle.getCharSequence介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public View onCreateView(LayoutInflater inflater,
             ViewGroup container,
             Bundle savedInstanceState) {
 View result=inflater.inflate(R.layout.editor, container, false);
 editor=(EditText)result.findViewById(R.id.editor);
 editor.setHint(getTitle());
 editor.setText(getArguments().getCharSequence(KEY_TEXT));
 return(result);
}

代码示例来源:origin: konmik/nucleus

when(bundle.getCharSequence(anyString())).thenAnswer(get);
when(bundle.getCharSequence(anyString(), any(CharSequence.class))).thenAnswer(getOrDefault);

代码示例来源:origin: bluelinelabs/Conductor

@Override
public void onViewBound(@NonNull View view) {
  super.onViewBound(view);
  tvTitle.setText(getArgs().getCharSequence(KEY_TITLE));
  tvDescription.setText(getArgs().getCharSequence(KEY_DESCRIPTION));
  tvDescription.setMovementMethod(LinkMovementMethod.getInstance());
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onReceive(Context ctxt, Intent i) {
  Bundle input=RemoteInput.getResultsFromIntent(i);

  if (input!=null) {
   CharSequence speech=input.getCharSequence(EXTRA_SPEECH);

   if (speech!=null) {
    Log.d(getClass().getSimpleName(), speech.toString());
   }
   else {
    Log.e(getClass().getSimpleName(), "No voice response speech");
   }
  }
  else {
   Log.e(getClass().getSimpleName(), "No voice response Bundle");
  }
 }
}

代码示例来源:origin: stackoverflow.com

private TextView mTextView;
private static final String KEY_TEXT_VALUE = "textValue";

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  mTextView = (TextView) findViewById(R.id.main);
  if (savedInstanceState != null) {
   CharSequence savedText = savedInstanceState.getCharSequence(KEY_TEXT_VALUE);
   mTextView.setText(savedText);
  }
}

@Override
protected void onSaveInstanceState (Bundle outState) {
  super.onSaveInstanceState(outState);
  outState.putCharSequence(KEY_TEXT_VALUE, mTextView.getText());
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onViewCreated(@NonNull View view,
             @Nullable Bundle savedInstanceState) {
 if (savedInstanceState == null) {
  initAdapter(null);
 }
 else {
  initAdapter(savedInstanceState.getStringArrayList(STATE_MODEL));
  initialQuery=savedInstanceState.getCharSequence(STATE_QUERY);
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
 public void onReceive(Context ctxt, Intent i) {
  Bundle input=RemoteInput.getResultsFromIntent(i);

  if (input!=null) {
   CharSequence speech=input.getCharSequence(EXTRA_INPUT);

   if (speech!=null) {
    Log.d(getClass().getSimpleName(), speech.toString());
   }
   else {
    Log.e(getClass().getSimpleName(), "No voice response speech");
   }
  }
  else {
   Log.e(getClass().getSimpleName(), "No voice response Bundle");
  }

  NotificationCompat.Builder builder=
   buildNotificationBase(ctxt);

  NotificationManagerCompat
   .from(ctxt)
   .notify(RemoteInputReceiver.NOTIFY_ID, builder.build());
 }
}

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

public CharSequence getContentText() {
 return RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.N
   ? realNotification.extras.getCharSequence(Notification.EXTRA_TEXT)
   : findText(applyContentView(), "text");
}

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

public CharSequence getContentInfo() {
 if (getApiLevel() >= N) {
  return realNotification.extras.getCharSequence(Notification.EXTRA_INFO_TEXT);
 } else {
  return findText(applyContentView(), "info");
 }
}

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

public CharSequence getBigContentTitle() {
 if (getApiLevel() >= N) {
  return realNotification.extras.getCharSequence(Notification.EXTRA_TITLE_BIG);
 } else {
  return findText(applyBigContentView(), "title");
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onReceive(Context ctxt, Intent i) {
 Bundle input=RemoteInput.getResultsFromIntent(i);
 if (input!=null) {
  CharSequence text=input.getCharSequence(EXTRA_INPUT);
  if (text!=null) {
   MESSAGES.push(new Message(text));
  }
  else {
   Log.e(getClass().getSimpleName(), "No voice response speech");
  }
 }
 else {
  Log.e(getClass().getSimpleName(), "No voice response Bundle");
 }
 NotificationManagerCompat
  .from(ctxt)
  .notify(RemoteInputReceiver.NOTIFY_ID,
   buildNotification(ctxt).build());
}

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

public CharSequence getBigText() {
 if (getApiLevel() >= N) {
  return realNotification.extras.getCharSequence(Notification.EXTRA_BIG_TEXT);
 } else {
  return findText(applyBigContentView(), "big_text");
 }
}

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

public CharSequence getContentTitle() {
 return RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.N
   ? realNotification.extras.getCharSequence(Notification.EXTRA_TITLE)
   : findText(applyContentView(), "title");
}

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

public CharSequence getBigContentText() {
 if (getApiLevel() >= N) {
  return realNotification.extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT);
 } else {
  return findText(applyBigContentView(),  "text");
 }
}

代码示例来源:origin: aporter/coursera-android

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  mTextView = findViewById(R.id.textView);
  if (null != savedInstanceState) {
    mRetainedFragment = (RetainedFragment) getFragmentManager()
        .findFragmentByTag(RetainedFragment.TAG);
    mTextView.setText(savedInstanceState.getCharSequence(MTEXTVIEW_TEXT_KEY));
  } else {
    mRetainedFragment = new RetainedFragment();
    getFragmentManager().beginTransaction()
        .add(mRetainedFragment, RetainedFragment.TAG)
        .commit();
  }
}

代码示例来源:origin: aporter/coursera-android

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  mTextView = findViewById(R.id.textView);
  if (null != savedInstanceState) {
    mRetainedFragment = (RetainedFragment) getFragmentManager()
        .findFragmentByTag(RetainedFragment.TAG);
    mTextView.setText(savedInstanceState.getCharSequence(MTEXTVIEW_TEXT_KEY));
  } else {
  mRetainedFragment = new RetainedFragment();
  getFragmentManager().beginTransaction()
      .add(mRetainedFragment, RetainedFragment.TAG)
      .commit();
  }
}

代码示例来源:origin: stackoverflow.com

vstup.setText(savedState.getCharSequence(App.VSTUP));

代码示例来源:origin: ACRA/acra

final CharSequence comment = remoteInput.getCharSequence(NotificationInteraction.KEY_COMMENT);
if (comment != null && !"".equals(comment.toString())) {
  final CrashReportPersister persister = new CrashReportPersister();

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

@Test
@Config(minSdk = JELLY_BEAN_MR2)
public void testGetApplicationRestrictions() {
 String packageName = context.getPackageName();
 assertThat(userManager.getApplicationRestrictions(packageName).size()).isEqualTo(0);
 Bundle restrictions = new Bundle();
 restrictions.putCharSequence("test_key", "test_value");
 shadowOf(userManager).setApplicationRestrictions(packageName, restrictions);
 assertThat(
     userManager
       .getApplicationRestrictions(packageName)
       .getCharSequence("test_key")
       .toString())
   .isEqualTo("test_value");
}

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

@Test
public void getApplicationRestrictions() {
 assertThat(restrictionsManager.getApplicationRestrictions()).isNull();
 Bundle bundle = new Bundle();
 bundle.putCharSequence("test_key", "test_value");
 shadowOf(restrictionsManager).setApplicationRestrictions(bundle);
 assertThat(restrictionsManager.getApplicationRestrictions().getCharSequence("test_key")).isEqualTo("test_value");
}

相关文章

Bundle类方法