List of usage examples for android.app Activity setTitle
public void setTitle(int titleId)
From source file:Main.java
public static void setTitle(Activity context, String titlemsg) { context.setTitle(titlemsg); }
From source file:Main.java
public static void DefinirTheme(Activity activity, String titulo) { if (android.os.Build.VERSION.SDK_INT < 11) { activity.setTheme(android.R.style.Theme_Light); activity.setTitle(titulo); } else {//from w w w.ja v a2s . c om activity.setTheme(android.R.style.Theme_Holo_Light); } }
From source file:Main.java
public static final void setActivityTitle(Activity activity, int... ids) { StringBuilder title = new StringBuilder(); for (int i = 0; i < ids.length; i++) { title.append(activity.getString(ids[i])); if (i < ids.length - 1) { title.append(TITLE_ENTRIES_SEPARATOR); }/*from w w w . jav a 2 s . co m*/ } activity.setTitle(title); }
From source file:com.gm.goldencity.util.Utils.java
/** * Changing default language/* w ww. j a v a2 s . c om*/ * * @param context Application context * @param language_code Lang code to FA or EN - BR and etc. * @param title Will set to activity */ public static void changeLanguage(Context context, String language_code, String title) { Resources res = context.getResources(); // Change locale settings in the app. DisplayMetrics dm = res.getDisplayMetrics(); android.content.res.Configuration conf = res.getConfiguration(); conf.locale = new Locale(language_code); res.updateConfiguration(conf, dm); Activity activity = (Activity) context; activity.setTitle(title); }
From source file:de.baumann.hhsmoodle.helper.helper_webView.java
public static void webView_WebViewClient(final Activity from, final SwipeRefreshLayout swipeRefreshLayout, final WebView webView) { webView.setWebViewClient(new WebViewClient() { ProgressDialog progressDialog;//from ww w . jav a2s . c om int numb; public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); ViewPager viewPager = (ViewPager) from.findViewById(R.id.viewpager); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(from); sharedPref.edit().putString("loadURL", webView.getUrl()).apply(); if (viewPager.getCurrentItem() == 0) { if (url != null) { from.setTitle(webView.getTitle()); } } if (url != null && url.contains("moodle.huebsch.ka.schule-bw.de/moodle/") && url.contains("/login/")) { if (viewPager.getCurrentItem() == 0 && numb != 1) { progressDialog = new ProgressDialog(from); progressDialog.setTitle(from.getString(R.string.login_title)); progressDialog.setMessage(from.getString(R.string.login_text)); progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, from.getString(R.string.toast_settings), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { helper_main.switchToActivity(from, Activity_settings.class, true); } }); progressDialog.show(); numb = 1; progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { numb = 0; } }); } } else if (progressDialog != null && progressDialog.isShowing()) { progressDialog.cancel(); numb = 0; } swipeRefreshLayout.setRefreshing(false); class_SecurePreferences sharedPrefSec = new class_SecurePreferences(from, "sharedPrefSec", "Ywn-YM.XK$b:/:&CsL8;=L,y4", true); String username = sharedPrefSec.getString("username"); String password = sharedPrefSec.getString("password"); final String js = "javascript:" + "document.getElementById('password').value = '" + password + "';" + "document.getElementById('username').value = '" + username + "';" + "var ans = document.getElementsByName('answer');" + "document.getElementById('loginbtn').click()"; if (Build.VERSION.SDK_INT >= 19) { view.evaluateJavascript(js, new ValueCallback<String>() { @Override public void onReceiveValue(String s) { } }); } else { view.loadUrl(js); } } @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { final Uri uri = Uri.parse(url); return handleUri(uri); } @TargetApi(Build.VERSION_CODES.N) @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { final Uri uri = request.getUrl(); return handleUri(uri); } private boolean handleUri(final Uri uri) { Log.i(TAG, "Uri =" + uri); final String url = uri.toString(); // Based on some condition you need to determine if you are going to load the url // in your web view itself or in a browser. // You can use `host` or `scheme` or any part of the `uri` to decide. if (url.startsWith("http")) return false;//open web links as usual //try to find browse activity to handle uri Uri parsedUri = Uri.parse(url); PackageManager packageManager = from.getPackageManager(); Intent browseIntent = new Intent(Intent.ACTION_VIEW).setData(parsedUri); if (browseIntent.resolveActivity(packageManager) != null) { from.startActivity(browseIntent); return true; } //if not activity found, try to parse intent:// if (url.startsWith("intent:")) { try { Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME); if (intent.resolveActivity(from.getPackageManager()) != null) { from.startActivity(intent); return true; } //try to find fallback url String fallbackUrl = intent.getStringExtra("browser_fallback_url"); if (fallbackUrl != null) { webView.loadUrl(fallbackUrl); return true; } //invite to install Intent marketIntent = new Intent(Intent.ACTION_VIEW) .setData(Uri.parse("market://details?id=" + intent.getPackage())); if (marketIntent.resolveActivity(packageManager) != null) { from.startActivity(marketIntent); return true; } } catch (URISyntaxException e) { //not an intent uri } } return true;//do nothing in other cases } }); }
From source file:com.jpventura.alexandria.About.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.setTitle(R.string.about); }
From source file:bbct.android.common.activity.About.java
@Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.about, container, false); String aboutTitle = this.getString(R.string.about_title); String title = this.getString(R.string.bbct_title, aboutTitle); Activity activity = Objects.requireNonNull(getActivity()); activity.setTitle(title); TextView versionLabel = view.findViewById(R.id.version_label); String versionNumber = this.getString(R.string.version_number); String versionString = this.getString(R.string.version_text, versionNumber); Log.d(TAG, "versionLabel=" + versionLabel); Log.d(TAG, "versionString=" + versionString); versionLabel.setText(versionString); return view;/*w w w . j a va 2 s . c o m*/ }
From source file:ch.jeda.platform.android.LogFragment.java
@Override public void onAttach(final Activity activity) { super.onAttach(activity); activity.setTitle("Jeda Log"); }
From source file:com.jpventura.alexandria.ListOfBooks.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.setTitle(R.string.books); }
From source file:com.jpventura.alexandria.AddBook.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); activity.setTitle(R.string.scan); }