本文整理汇总了Java中com.example.android.apis.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
R类属于com.example.android.apis包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showNotification
import com.example.android.apis.R; //导入依赖的package包/类
/**
* Show a notification while this service is running.
*/
private void showNotification() {
// In this sample, we'll use the same text for the ticker and the expanded notification
CharSequence text = getText(R.string.local_service_started);
// Set the icon, scrolling text and timestamp
Notification notification = new Notification(getHostIdentifier("demo_notification", "image", null), text,
System.currentTimeMillis());
// The PendingIntent to launch our activity if the user selects this notification
PendingIntent contentIntent = org.bbs.apklauncher.emb.PendingIntentHelper.getActivity(this, 0,
new org.bbs.apklauncher.emb.IntentHelper(this, LocalServiceActivities.Controller.class), 0);
// Set the info for the views that show in the notification panel.
notification.setLatestEventInfo(this, getText(R.string.local_service_label),
text, contentIntent);
// Send the notification.
mNM.notify(NOTIFICATION, notification);
}
示例2: updateContents
import com.example.android.apis.R; //导入依赖的package包/类
private void updateContents() {
// Show either the content in the main activity or the content in the presentation
// along with some descriptive text about what is happening.
if (mPresentation != null) {
mInfoTextView.setText(getResources().getString(
R.string.presentation_with_media_router_now_playing_remotely,
mPresentation.getDisplay().getName()));
mSurfaceView.setVisibility(View.INVISIBLE);
mSurfaceView.onPause();
if (mPaused) {
mPresentation.getSurfaceView().onPause();
} else {
mPresentation.getSurfaceView().onResume();
}
} else {
mInfoTextView.setText(getResources().getString(
R.string.presentation_with_media_router_now_playing_locally,
getWindowManager().getDefaultDisplay().getName()));
mSurfaceView.setVisibility(View.VISIBLE);
if (mPaused) {
mSurfaceView.onPause();
} else {
mSurfaceView.onResume();
}
}
}
示例3: onCreate
import com.example.android.apis.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.table_layout_8);
final TableLayout table = (TableLayout) findViewById(R.id.menu);
Button button = (Button) findViewById(R.id.toggle);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
mStretch = !mStretch;
table.setColumnStretchable(1, mStretch);
}
});
mStretch = table.isColumnStretchable(1);
appendRow(table);
}
示例4: addFragmentToStack
import com.example.android.apis.R; //导入依赖的package包/类
void addFragmentToStack() {
mStackLevel++;
// Instantiate a new fragment.
Fragment newFragment = CountingFragment.newInstance(mStackLevel);
// Add the fragment to the activity, pushing this transaction
// on to the back stack.
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(R.animator.fragment_slide_left_enter,
R.animator.fragment_slide_left_exit,
R.animator.fragment_slide_right_enter,
R.animator.fragment_slide_right_exit);
ft.replace(R.id.simple_fragment, newFragment);
ft.addToBackStack(null);
ft.commit();
}
示例5: onCreate
import com.example.android.apis.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.redirect_getter);
// Watch for button clicks.
Button applyButton = (Button)findViewById(R.id.apply);
applyButton.setOnClickListener(mApplyListener);
// The text being set.
mText = (TextView)findViewById(R.id.text);
// Display the stored values, or if not stored initialize with an empty String
loadPrefs();
}
示例6: onCreate
import com.example.android.apis.R; //导入依赖的package包/类
@Override
public void onCreate() {
mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Toast.makeText(this, R.string.service_created,
Toast.LENGTH_SHORT).show();
// This is who should be launched if the user selects our persistent
// notification.
mInvokeIntent = new Intent(this, Controller.class);
// Start up the thread running the service. Note that we create a
// separate thread because the service normally runs in the process's
// main thread, which we don't want to block. We also make it
// background priority so CPU-intensive work will not disrupt our UI.
HandlerThread thread = new HandlerThread("ServiceStartArguments",
Process.THREAD_PRIORITY_BACKGROUND);
thread.start();
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
示例7: setupTransition
import com.example.android.apis.R; //导入依赖的package包/类
private void setupTransition(LayoutTransition transition) {
CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB);
CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB);
CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB);
CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB);
CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB);
transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ?
(customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null);
transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ?
(customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null);
transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ?
(customAnimCB.isChecked() ? customChangingAppearingAnim :
defaultChangingAppearingAnim) : null);
transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING,
changingDisappearingCB.isChecked() ?
(customAnimCB.isChecked() ? customChangingDisappearingAnim :
defaultChangingDisappearingAnim) : null);
}
示例8: showNotification
import com.example.android.apis.R; //导入依赖的package包/类
/**
* Show a notification while this service is running.
*/
private void showNotification() {
// In this sample, we'll use the same text for the ticker and the expanded notification
CharSequence text = getText(R.string.remote_service_started);
// Set the icon, scrolling text and timestamp
Notification notification = new Notification(R.drawable.stat_sample, text,
System.currentTimeMillis());
// The PendingIntent to launch our activity if the user selects this notification
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, Controller.class), 0);
// Set the info for the views that show in the notification panel.
notification.setLatestEventInfo(this, getText(R.string.remote_service_label),
text, contentIntent);
// Send the notification.
// We use a string id because it is a unique number. We use it later to cancel.
mNM.notify(R.string.remote_service_started, notification);
}
示例9: onCreate
import com.example.android.apis.R; //导入依赖的package包/类
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tasklist_main);
// Hard-coded hand-waving here.
boolean[] checkboxes = {true, true, false, true, false, false, false};
String[] labels = {"Take out Trash", "Do Laundry",
"Conquer World", "Nap", "Do Taxes",
"Abolish IRS", "Tea with Aunt Sharon" };
TaskAdapter myAdapter = new TaskAdapter(this, labels, checkboxes);
this.setListAdapter(myAdapter);
// Add a shortcut to the accessibility settings.
ImageButton button = (ImageButton) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(sSettingsIntent);
}
});
}
示例10: onCreate
import com.example.android.apis.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_dialog);
View tv = findViewById(R.id.text);
((TextView)tv).setText("Example of displaying dialogs with a DialogFragment. "
+ "Press the show button below to see the first dialog; pressing "
+ "successive show buttons will display other dialog styles as a "
+ "stack, with dismissing or back going to the previous dialog.");
// Watch for button clicks.
Button button = (Button)findViewById(R.id.show);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDialog();
}
});
if (savedInstanceState != null) {
mStackLevel = savedInstanceState.getInt("level");
}
}
示例11: addShowHideListener
import com.example.android.apis.R; //导入依赖的package包/类
void addShowHideListener(int buttonId, final Fragment fragment) {
final Button button = (Button)findViewById(buttonId);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(android.R.animator.fade_in,
android.R.animator.fade_out);
if (fragment.isHidden()) {
ft.show(fragment);
button.setText("Hide");
} else {
ft.hide(fragment);
button.setText("Show");
}
ft.commit();
}
});
}
示例12: onRatingChanged
import com.example.android.apis.R; //导入依赖的package包/类
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) {
final int numStars = ratingBar.getNumStars();
mRatingText.setText(
getString(R.string.ratingbar_rating) + " " + rating + "/" + numStars);
// Since this rating bar is updated to reflect any of the other rating
// bars, we should update it to the current values.
if (mIndicatorRatingBar.getNumStars() != numStars) {
mIndicatorRatingBar.setNumStars(numStars);
mSmallRatingBar.setNumStars(numStars);
}
if (mIndicatorRatingBar.getRating() != rating) {
mIndicatorRatingBar.setRating(rating);
mSmallRatingBar.setRating(rating);
}
final float ratingBarStepSize = ratingBar.getStepSize();
if (mIndicatorRatingBar.getStepSize() != ratingBarStepSize) {
mIndicatorRatingBar.setStepSize(ratingBarStepSize);
mSmallRatingBar.setStepSize(ratingBarStepSize);
}
}
示例13: onCreateView
import com.example.android.apis.R; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_tabs_fragment, container, false);
TabHost host = mTabManager.handleCreateView(v);
mTabManager.addTab(host.newTabSpec("result").setIndicator("Result"),
FragmentReceiveResult.ReceiveResultFragment.class, null);
mTabManager.addTab(host.newTabSpec("contacts").setIndicator("Contacts"),
LoaderCursor.CursorLoaderListFragment.class, null);
mTabManager.addTab(host.newTabSpec("apps").setIndicator("Apps"),
LoaderCustom.AppListFragment.class, null);
mTabManager.addTab(host.newTabSpec("throttle").setIndicator("Throttle"),
LoaderThrottle.ThrottledLoaderListFragment.class, null);
return v;
}
示例14: SampleView
import com.example.android.apis.R; //导入依赖的package包/类
public SampleView(Context context) {
super(context);
setFocusable(true);
mBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.beach);
float w = mBitmap.getWidth();
float h = mBitmap.getHeight();
// construct our mesh
int index = 0;
for (int y = 0; y <= HEIGHT; y++) {
float fy = h * y / HEIGHT;
for (int x = 0; x <= WIDTH; x++) {
float fx = w * x / WIDTH;
setXY(mVerts, index, fx, fy);
setXY(mOrig, index, fx, fy);
index += 1;
}
}
mMatrix.setTranslate(10, 10);
mMatrix.invert(mInverse);
}
示例15: onCreateOptionsMenu
import com.example.android.apis.R; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate your menu.
getMenuInflater().inflate(R.menu.action_bar_share_action_provider, menu);
// Set file with share history to the provider and set the share intent.
MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
// Note that you can set/change the intent any time,
// say when the user has selected an image.
actionProvider.setShareIntent(createShareIntent());
// Set file with share history to the provider and set the share intent.
MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow);
ShareActionProvider overflowProvider =
(ShareActionProvider) overflowItem.getActionProvider();
overflowProvider.setShareHistoryFileName(
ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
// Note that you can set/change the intent any time,
// say when the user has selected an image.
overflowProvider.setShareIntent(createShareIntent());
return true;
}