Java Code Examples for android.app.AlertDialog#getLayoutInflater()

The following examples show how to use android.app.AlertDialog#getLayoutInflater() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SuggestedUpdateViewImpl.java    From applivery-android-sdk with Apache License 2.0 6 votes vote down vote up
private AlertDialog createAlertDialog(Context context, UpdateInfo updateInfo) {
  final FrameLayout frameView = new FrameLayout(context);
  builder.setView(frameView);

  final AlertDialog alertDialog = builder.create();
  LayoutInflater inflater = alertDialog.getLayoutInflater();
  inflater.inflate(R.layout.applivery_suggested_update, frameView);
  TextView textView = frameView.findViewById(R.id.suggested_update_text);

  String appliveryUpdateMsg = context.getString(R.string.appliveryUpdateMsg);

  if (!appliveryUpdateMsg.isEmpty()) {
    textView.setText(appliveryUpdateMsg);
  } else {
    if (updateInfo != null) {
      textView.setText(updateInfo.getAppUpdateMessage());
    }
  }
  return alertDialog;
}
 
Example 2
Source File: MainActivity.java    From ThinDownloadManager with Apache License 2.0 6 votes vote down vote up
private void showInternalFilesDir() {
    File internalFile = new File(getExternalFilesDir("").getPath());
    File files[] = internalFile.listFiles();
    StringBuilder contentText = new StringBuilder();
    if( files.length == 0 ) {
        contentText = new StringBuilder("No Files Found");
    }

    for (File file : files) {
        contentText.append(file.getName()).append(" ").append(file.length()).append(" \n\n ");
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    AlertDialog internalCacheDialog = builder.create();
    LayoutInflater inflater = internalCacheDialog.getLayoutInflater();
    View dialogLayout = inflater.inflate(R.layout.layout_files, null);
    TextView content = (TextView) dialogLayout.findViewById(R.id.filesList);
    content.setText(contentText.toString());

    builder.setView(dialogLayout);
    builder.show();

}