当前位置: 首页>>代码示例>>Java>>正文


Java Context.getText方法代码示例

本文整理汇总了Java中android.content.Context.getText方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getText方法的具体用法?Java Context.getText怎么用?Java Context.getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Context的用法示例。


在下文中一共展示了Context.getText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HeaderItem

import android.content.Context; //导入方法依赖的package包/类
HeaderItem(Context context, Session session, boolean connecting) {
    if (connecting) {
        // Conectando
        iconResource = R.drawable.ic_profile;
        mainText = context.getText(R.string.connecting);
        secondaryText = null;
    }
    else if (session != null) {
        // En Sesión
        iconResource = R.drawable.ic_action_name;
        mainText = session.getMe().getName();
        secondaryText = session.getMe().getProfile().getEmail();
    } else {
        // Sin Sesión
        iconResource = R.drawable.ic_profile;
        mainText = context.getText(R.string.default_drawer_message);
        secondaryText = context.getText(R.string.default_drawer_mail);
    }
}
 
开发者ID:UTN-FRBA-Mobile,项目名称:Clases-2017c1,代码行数:20,代码来源:DrawerAdapter.java

示例2: detailMusic

import android.content.Context; //导入方法依赖的package包/类
/**
 * Song Details
 *
 * @param context
 * @param title
 * @param album
 * @param artist
 * @param trackno
 * @param data
 */
public static void detailMusic(Context context, String title, String album, String artist,
                               int trackno, String data) {
    if (data != null) {
        File file = new File(data);
        if (file.exists()) {
            float cal = (file.length() / 1024);
            String content = context.getText(R.string.song_Name) +
                    title +
                    "\n\n" +
                    context.getText(R.string.album_name) +
                    album +
                    "\n\n" +
                    context.getString(R.string.artist_name) +
                    artist +
                    "\n\n" +
                    context.getText(R.string.trackno) +
                    trackno +
                    "\n\n" +
                    context.getText(R.string.file_path) +
                    data +
                    "\n\n" +
                    context.getText(R.string.file_size) +
                    String.valueOf(String.format("%.2f", cal / 1024)) +
                    " MB";
            new MaterialDialog.Builder(context)
                    .title(R.string.action_details)
                    .content(content)
                    .positiveText(R.string.okay)
                    .typeface(getFont(context), getFont(context))
                    .onPositive((materialDialog, dialogAction) -> materialDialog.dismiss())
                    .show();
        } else {
            Toast.makeText(context, "File path not found", Toast.LENGTH_SHORT).show();
        }
    } else {
        Log.d("Helper", "path not found");
    }

}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:50,代码来源:Helper.java

示例3: updateWidget

import android.content.Context; //导入方法依赖的package包/类
private static void updateWidget(Context context, AppWidgetManager manager, int appWidgetId, boolean serviceRunning) {


        RemoteViews updateViews = new RemoteViews(context.getPackageName(), R.layout.widget_recording);

        // change the subtext depending on whether the service is running or not
        CharSequence subtext = context.getText(
                serviceRunning ? R.string.widget_recording_in_progress : R.string.widget_start_recording);
        updateViews.setTextViewText(R.id.widget_subtext, subtext);

        // if service not running, don't show the "recording" icon
        updateViews.setViewVisibility(R.id.record_badge_image_view, serviceRunning ? View.VISIBLE : View.INVISIBLE);

        PendingIntent pendingIntent = getPendingIntent(context, appWidgetId);

        updateViews.setOnClickPendingIntent(R.id.clickable_linear_layout, pendingIntent);

        manager.updateAppWidget(appWidgetId, updateViews);

    }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:21,代码来源:WidgetHelper.java

示例4: onDisableRequested

import android.content.Context; //导入方法依赖的package包/类
@Override
public CharSequence onDisableRequested(Context context, Intent intent) {
	return context.getText(R.string.device_admin_disable_confirmation);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:5,代码来源:SecureNoteDeviceAdminReceiver.java


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