當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。