本文整理汇总了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);
}
}
示例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");
}
}
示例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);
}
示例4: onDisableRequested
import android.content.Context; //导入方法依赖的package包/类
@Override
public CharSequence onDisableRequested(Context context, Intent intent) {
return context.getText(R.string.device_admin_disable_confirmation);
}