Tabnine Logo
android.app
Code IndexAdd Tabnine to your IDE (free)

How to use android.app

Best Java code snippets using android.app (Showing top 20 results out of 31,077)

origin: stackoverflow.com

 String url = "url you want to download";
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("Some descrition");
request.setTitle("Some title");
// in order for this if to run, you must use the android 3.2 to compile your app
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
  request.allowScanningByMediaScanner();
  request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "name-of-the-file.ext");

// get download service and enqueue file
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
origin: stackoverflow.com

 @Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
 Dialog dialog = super.onCreateDialog(savedInstanceState);

 // request a window without the title
 dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
 return dialog;
}
origin: square/leakcanary

 @Override public void watchFragments(Activity activity) {
  FragmentManager fragmentManager = activity.getFragmentManager();
  fragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleCallbacks, true);
 }
}
origin: androidannotations/androidannotations

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
  }
}
origin: stackoverflow.com

 AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Look at this dialog!")
    .setCancelable(false)
    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int id) {
        //do things
      }
    });
AlertDialog alert = builder.create();
alert.show();
origin: bumptech/glide

DefaultRetrieverHarness() {
 this.parent = new android.app.Fragment();
 controller.create();
 controller.get().getFragmentManager().beginTransaction().add(parent, PARENT_TAG)
   .commitAllowingStateLoss();
 controller.get().getFragmentManager().executePendingTransactions();
 controller.start().resume();
}
origin: libgdx/libgdx

@Override
protected void onDestroy () {
  super.onDestroy();
}
origin: bumptech/glide

private static boolean isActivityVisible(Activity activity) {
 // This is a poor heuristic, but it's about all we have. We'd rather err on the side of visible
 // and start requests than on the side of invisible and ignore valid requests.
 return !activity.isFinishing();
}
origin: bumptech/glide

@Override
public boolean hasFragmentWithTag(String tag) {
 return null != controller
   .get()
   .getFragmentManager()
   .findFragmentByTag(RequestManagerRetriever.FRAGMENT_TAG);
}
origin: libgdx/libgdx

@Override
public void onConfigurationChanged (Configuration config) {
  super.onConfigurationChanged(config);
  boolean keyboardAvailable = false;
  if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) keyboardAvailable = true;
  input.keyboardAvailable = keyboardAvailable;
}
origin: stackoverflow.com

 final AlertDialog dialog = ...;

editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View v, boolean hasFocus) {
    if (hasFocus) {
      dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    }
  }
});
origin: square/leakcanary

@Override public void setTheme(int resid) {
 // We don't want this to be called with an incompatible theme.
 // This could happen if you implement runtime switching of themes
 // using ActivityLifecycleCallbacks.
 if (resid != R.style.leak_canary_LeakCanary_Base) {
  return;
 }
 super.setTheme(resid);
}
origin: square/leakcanary

 public void stopWatchingActivities() {
  application.unregisterActivityLifecycleCallbacks(lifecycleCallbacks);
 }
}
origin: androidannotations/androidannotations

  @Override
  public boolean onKeyLongPress(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_E) {
      isELongPressedInAnnotatedClass = true;
    }
    return super.onKeyLongPress(keyCode, event);
  }
}
origin: androidannotations/androidannotations

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
}
origin: bumptech/glide

 @SuppressWarnings("deprecation")
 @Override
 public void addFragmentWithTag(String tag, RequestManager requestManager) {
  RequestManagerFragment fragment = new RequestManagerFragment();
  fragment.setRequestManager(requestManager);
  controller.get().getFragmentManager().beginTransaction()
    .add(fragment, RequestManagerRetriever.FRAGMENT_TAG).commitAllowingStateLoss();
  controller.get().getFragmentManager().executePendingTransactions();
 }
}
origin: libgdx/libgdx

@Override
protected void onDestroy () {
  super.onDestroy();
}
origin: libgdx/libgdx

@Override
public void onConfigurationChanged (Configuration config) {
  super.onConfigurationChanged(config);
  boolean keyboardAvailable = false;
  if (config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) keyboardAvailable = true;
  input.keyboardAvailable = keyboardAvailable;
}
origin: androidannotations/androidannotations

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
}
origin: androidannotations/androidannotations

@Override
protected void onDestroy() {
  super.onDestroy();
  // Robolectric does not create a new instance after Activity.recreate
  // we simulate the new instance by clearing our fields
  maintainedDependency = null;
  recreatedDependency = null;
  maintainedAbstracted = null;
  someObject = null;
}
android.app

Most used classes

  • Activity
  • Application
  • AlertDialog$Builder
  • Dialog
  • PendingIntent
  • AlertDialog,
  • ProgressDialog,
  • Service,
  • FragmentManager,
  • FragmentTransaction,
  • ActivityManager,
  • Fragment,
  • NotificationChannel,
  • AlarmManager,
  • Instrumentation,
  • ListActivity,
  • ActionBar,
  • Notification$Builder,
  • DialogFragment
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now