• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java R类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.example.android.apis.R的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



R类属于com.example.android.apis包,在下文中一共展示了R类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:23,代码来源:LocalService.java


示例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();
        }
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:27,代码来源:PresentationWithMediaRouterActivity.java


示例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);
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:20,代码来源:TableLayout8.java


示例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();
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:18,代码来源:FragmentCustomAnimations.java


示例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();
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:18,代码来源:RedirectGetter.java


示例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);
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:23,代码来源:ServiceStartArguments.java


示例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);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:19,代码来源:LayoutAnimations.java


示例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);
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:24,代码来源:MessengerService.java


示例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);
        }
    });
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:25,代码来源:TaskListActivity.java


示例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");
    }
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:24,代码来源:FragmentDialog.java


示例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();
        }
    });
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:19,代码来源:FragmentHideShow.java


示例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);
    }
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:22,代码来源:RatingBar1.java


示例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;
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:18,代码来源:FragmentTabsFragment.java


示例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);
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:25,代码来源:BitmapMesh.java


示例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;
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:26,代码来源:ActionBarShareActionProviderActivity.java


示例16: onCreate

import com.example.android.apis.R; //导入依赖的package包/类
/**
 * Standard initialization of this activity.  Set up the UI, then wait
 * for the user to poke it before doing anything.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.messenger_service_binding);

    // Watch for button clicks.
    Button button = (Button)findViewById(R.id.bind);
    button.setOnClickListener(mBindListener);
    button = (Button)findViewById(R.id.unbind);
    button.setOnClickListener(mUnbindListener);
    
    mCallbackText = (TextView)findViewById(R.id.callback);
    mCallbackText.setText("Not attached.");
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:20,代码来源:MessengerServiceActivities.java


示例17: onCreateOptionsMenu

import com.example.android.apis.R; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.content_actions, menu);
    SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
    searchView.setOnQueryTextListener(this);

    // 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.
    Intent shareIntent = new org.bbs.apklauncher.emb.IntentHelper(Intent.ACTION_SEND);
    shareIntent.setType("image/*");
    Uri uri = Uri.fromFile(getFileStreamPath("shared.png"));
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    actionProvider.setShareIntent(shareIntent);
    return true;
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:21,代码来源:ContentBrowserActivity.java


示例18: 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 an alert dialog with a DialogFragment");

    // Watch for button clicks.
    Button button = (Button)findViewById(R.id.show);
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            showDialog();
        }
    });
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:17,代码来源:FragmentAlertDialog.java


示例19: updateAppWidget

import com.example.android.apis.R; //导入依赖的package包/类
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
        int appWidgetId, String titlePrefix) {
    Log.d(TAG, "updateAppWidget appWidgetId=" + appWidgetId + " titlePrefix=" + titlePrefix);
    // Getting the string this way allows the string to be localized.  The format
    // string is filled in using java.util.Formatter-style format strings.
    CharSequence text = context.getString(R.string.appwidget_text_format,
            ExampleAppWidgetConfigure.loadTitlePref(context, appWidgetId),
            "0x" + Long.toHexString(SystemClock.elapsedRealtime()));

    // Construct the RemoteViews object.  It takes the package name (in our case, it's our
    // package, but it needs this because on the other side it's the widget host inflating
    // the layout from our package).
    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider);
    views.setTextViewText(R.id.appwidget_text, text);

    // Tell the widget manager
    appWidgetManager.updateAppWidget(appWidgetId, views);
}
 
开发者ID:Sherchen,项目名称:ApiDemos,代码行数:19,代码来源:ExampleAppWidgetProvider.java


示例20: appendRow

import com.example.android.apis.R; //导入依赖的package包/类
private void appendRow(TableLayout table) {
    TableRow row = new TableRow(this);

    TextView label = new TextView(this);
    label.setText(R.string.table_layout_7_quit);
    label.setPadding(3, 3, 3, 3);

    TextView shortcut = new TextView(this);
    shortcut.setText(R.string.table_layout_7_ctrlq);
    shortcut.setPadding(3, 3, 3, 3);
    shortcut.setGravity(Gravity.RIGHT | Gravity.TOP);

    row.addView(label, new TableRow.LayoutParams(1));
    row.addView(shortcut, new TableRow.LayoutParams());

    table.addView(row, new TableLayout.LayoutParams());
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:18,代码来源:TableLayout7.java



注:本文中的com.example.android.apis.R类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XSMessageFormatter类代码示例发布时间:2022-05-23
下一篇:
Java ClientDatanodeProtocolServerSideTranslatorPB类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap