當前位置: 首頁>>代碼示例>>Java>>正文


Java InflateException類代碼示例

本文整理匯總了Java中android.view.InflateException的典型用法代碼示例。如果您正苦於以下問題:Java InflateException類的具體用法?Java InflateException怎麽用?Java InflateException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InflateException類屬於android.view包,在下文中一共展示了InflateException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: inflateMenu

import android.view.InflateException; //導入依賴的package包/類
public void inflateMenu(@MenuRes int menuRes) {
    if(menuRes == 0) return;
    if (isInEditMode()) return;
    getActivity().getMenuInflater().inflate(menuRes, mActionMenu.getMenu());

    XmlResourceParser parser = null;
    try {
        //noinspection ResourceType
        parser = getResources().getLayout(menuRes);
        AttributeSet attrs = Xml.asAttributeSet(parser);
        parseMenu(parser, attrs);
    } catch (XmlPullParserException | IOException e) {
        // should not happens
        throw new InflateException("Error parsing menu XML", e);
    } finally {
        if (parser != null) parser.close();
    }
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:19,代碼來源:FloatingSearchView.java

示例2: inflate

import android.view.InflateException; //導入依賴的package包/類
public void inflate(int menuRes, Menu menu) {
    if (menu instanceof SupportMenu) {
        XmlResourceParser parser = null;
        try {
            parser = this.mContext.getResources().getLayout(menuRes);
            parseMenu(parser, Xml.asAttributeSet(parser), menu);
            if (parser != null) {
                parser.close();
            }
        } catch (XmlPullParserException e) {
            throw new InflateException("Error inflating menu XML", e);
        } catch (IOException e2) {
            throw new InflateException("Error inflating menu XML", e2);
        } catch (Throwable th) {
            if (parser != null) {
                parser.close();
            }
        }
    } else {
        super.inflate(menuRes, menu);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:23,代碼來源:SupportMenuInflater.java

示例3: createView

import android.view.InflateException; //導入依賴的package包/類
private View createView(Context context, String name, String prefix)
        throws ClassNotFoundException, InflateException {
    Constructor<? extends View> constructor = sConstructorMap.get(name);

    try {
        if (constructor == null) {
            // Class not found in the cache, see if it's real, and try to add it
            Class<? extends View> clazz = context.getClassLoader().loadClass(
                    prefix != null ? (prefix + name) : name).asSubclass(View.class);

            constructor = clazz.getConstructor(sConstructorSignature);
            sConstructorMap.put(name, constructor);
        }
        constructor.setAccessible(true);
        return constructor.newInstance(mConstructorArgs);
    } catch (Exception e) {
        // We do not want to catch these, lets return null and let the actual LayoutInflater
        // try
        return null;
    }
}
 
開發者ID:wutongke,項目名稱:AndroidSkinAnimator,代碼行數:22,代碼來源:SkinCompatViewInflater.java

示例4: create

import android.view.InflateException; //導入依賴的package包/類
/**
  * Prepares an alert dialog builder, using the work_dialog view.
  * <p>
  * The caller should finish populating the builder, then call AlertDialog.Builder#show().
  */
 public static AlertDialog.Builder create(Activity activity, int titleId) {
     View view;
     try {
         view = activity.getLayoutInflater().inflate(R.layout.work_dialog, null);
     } catch (InflateException ie) {
         Log.e(TAG, "Exception while inflating work dialog layout: " + ie.getMessage());
         throw ie;
     }

     String title = activity.getString(titleId);
     AlertDialog.Builder builder = new AlertDialog.Builder(activity);
     builder.setTitle(title);
     builder.setView(view);
     return builder;
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:21,代碼來源:WorkDialog.java

示例5: display

import android.view.InflateException; //導入依賴的package包/類
/**
 * Displays the About box.  An AlertDialog is created in the calling activity's context.
 * <p>
 * The box will disappear if the "OK" button is touched, if an area outside the box is
 * touched, if the screen is rotated ... doing just about anything makes it disappear.
 */
public static void display(Activity caller) {
    String versionStr = getVersionString(caller);
    String aboutHeader = caller.getString(R.string.app_name) + " v" + versionStr;

    // Manually inflate the view that will form the body of the dialog.
    View aboutView;
    try {
        aboutView = caller.getLayoutInflater().inflate(R.layout.about_dialog, null);
    } catch (InflateException ie) {
        Log.e(TAG, "Exception while inflating about box: " + ie.getMessage());
        return;
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(caller);
    builder.setTitle(aboutHeader);
    builder.setIcon(R.drawable.ic_launcher);
    builder.setCancelable(true);        // implies setCanceledOnTouchOutside
    builder.setPositiveButton(R.string.ok, null);
    builder.setView(aboutView);
    builder.show();
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:28,代碼來源:AboutBox.java

示例6: inflate

import android.view.InflateException; //導入依賴的package包/類
public void inflate(int i, Menu menu) {
    if (menu instanceof C0089a) {
        XmlResourceParser xmlResourceParser = null;
        try {
            xmlResourceParser = this.f868e.getResources().getLayout(i);
            m2024a(xmlResourceParser, Xml.asAttributeSet(xmlResourceParser), menu);
            if (xmlResourceParser != null) {
                xmlResourceParser.close();
            }
        } catch (Throwable e) {
            throw new InflateException("Error inflating menu XML", e);
        } catch (Throwable e2) {
            throw new InflateException("Error inflating menu XML", e2);
        } catch (Throwable th) {
            if (xmlResourceParser != null) {
                xmlResourceParser.close();
            }
        }
    } else {
        super.inflate(i, menu);
    }
}
 
開發者ID:Qwaz,項目名稱:solved-hacking-problem,代碼行數:23,代碼來源:C0253i.java

示例7: initInflate

import android.view.InflateException; //導入依賴的package包/類
protected void initInflate(Context context) {
    try {
        View.inflate(context, getLayoutId(), this);
    } catch (InflateException e) {
        if (e.toString().contains("GSYImageCover")) {
            Debuger.printfError("********************\n" +
                    "*****   注意   *****" +
                    "********************\n" +
                    "*該版本需要清除布局文件中的GSYImageCover\n" +
                    "****  Attention  ***\n" +
                    "*Please remove GSYImageCover from Layout in this Version\n" +
                    "********************\n");
            e.printStackTrace();
            throw new InflateException("該版本需要清除布局文件中的GSYImageCover,please remove GSYImageCover from your layout");
        } else {
            e.printStackTrace();
        }
    }
}
 
開發者ID:CarGuo,項目名稱:GSYVideoPlayer,代碼行數:20,代碼來源:GSYVideoView.java

示例8: createView

import android.view.InflateException; //導入依賴的package包/類
private View createView(Context context, String name, String prefix)
        throws ClassNotFoundException, InflateException {
    Constructor<? extends View> constructor = sConstructorMap.get(name);

    try {
        if (constructor == null) {
            Class<? extends View> clazz = context.getClassLoader().loadClass(
                    prefix != null ? (prefix + name) : name).asSubclass(View.class);

            constructor = clazz.getConstructor(sConstructorSignature);
            sConstructorMap.put(name, constructor);
        }
        constructor.setAccessible(true);
        return constructor.newInstance(mConstructorArgs);
    } catch (Exception e) {
        return null;
    }
}
 
開發者ID:wlt2017,項目名稱:zhizhihuhu,代碼行數:19,代碼來源:NightModelManager.java

示例9: inflateMenu

import android.view.InflateException; //導入依賴的package包/類
public void inflateMenu(@MenuRes int menuRes) {
    if (menuRes == 0) return;
    getActivity().getMenuInflater()
                 .inflate(menuRes, mActionMenu.getMenu());

    XmlResourceParser parser = null;
    try {
        //noinspection ResourceType
        parser = getResources().getLayout(menuRes);
        AttributeSet attrs = Xml.asAttributeSet(parser);
        parseMenu(parser, attrs);
    } catch (XmlPullParserException | IOException e) {
        // should not happens
        throw new InflateException("Error parsing menu XML", e);
    } finally {
        if (parser != null) parser.close();
    }
}
 
開發者ID:SamuelGjk,項目名稱:GComic,代碼行數:19,代碼來源:FloatingSearchView.java

示例10: onCreateView

import android.view.InflateException; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    if (view != null) {
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null)
            parent.removeView(view);
    }
    try {
        view = inflater.inflate(R.layout.next_gen_list_view, container, false);
    } catch (InflateException e) {
    /* map is already there, just return view as it is */
    }
    return view;

}
 
開發者ID:warnerbros,項目名稱:cpe-manifest-android-experience,代碼行數:17,代碼來源:ExtraLeftListFragment.java

示例11: onCreateView

import android.view.InflateException; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    if (view != null) {
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null)
            parent.removeView(view);
    }
    try {
        view = inflater.inflate(getContentViewId(), container, false);
    } catch (InflateException e) {
        NextGenLogger.e(F.TAG, e.getLocalizedMessage());
    }
    return view;

}
 
開發者ID:warnerbros,項目名稱:cpe-manifest-android-experience,代碼行數:17,代碼來源:AbstractNextGenFragment.java

示例12: onCreateView

import android.view.InflateException; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    if (view != null) {
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null)
            parent.removeView(view);
    }
    try {
        view = inflater.inflate(R.layout.next_gen_ime_lower_frame, container, false);
    } catch (InflateException e) {
    /* map is already there, just return view as it is */
    }
    return view;

}
 
開發者ID:warnerbros,項目名稱:cpe-manifest-android-experience,代碼行數:17,代碼來源:IMEBottomFragment.java

示例13: onCreateView

import android.view.InflateException; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    if (view != null) {
        ViewGroup parent = (ViewGroup) view.getParent();
        if (parent != null)
            parent.removeView(view);
    }
    try {
        view = inflater.inflate(R.layout.establishment_fragment, container, false);
    } catch (InflateException e) {
        /* map is already there, just return view as it is */
    }
    ButterKnife.bind(this, view);

    ((MainActivity) getActivity()).setToolbarTitle(getContext().getString(R.string.establishments_title));

    toggleFabButton(false);
    mPresenter = new EstablishmentPresenterImpl(this, getContext(), getActivity());

    SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(mPresenter);

    return view;
}
 
開發者ID:matbrandao,項目名稱:Saude-no-Mapa,代碼行數:27,代碼來源:EstablishmentFragment.java

示例14: CanErvAdapter

import android.view.InflateException; //導入依賴的package包/類
public CanErvAdapter(RecyclerView mRecyclerView) {
    super();
    this.mContext = mRecyclerView.getContext();
    this.mRecyclerView = mRecyclerView;
    this.mGroupList = new ArrayList<>();
    this.mChildList = new ArrayList<>();

    RecyclerView.LayoutManager manager = mRecyclerView.getLayoutManager();

    if (manager == null) {
        throw new InflateException("LayoutManager is null");
    }
    if (manager instanceof GridLayoutManager) {

        mSpanCount = ((GridLayoutManager) manager).getSpanCount();
    }


}
 
開發者ID:canyinghao,項目名稱:CanAdapter,代碼行數:20,代碼來源:CanErvAdapter.java

示例15: createView

import android.view.InflateException; //導入依賴的package包/類
private View createView(String name, String prefix)
        throws ClassNotFoundException, InflateException {
    Constructor<? extends View> constructor = sConstructorMap.get(name);

    try {
        if (constructor == null) {
            // Class not found in the cache, see if it's real, and try to add it
            Class<? extends View> clazz = getClassLoader(mContext, name, prefix).loadClass(
                    prefix != null ? (prefix + name) : name).asSubclass(View.class);

            constructor = clazz.getConstructor(sConstructorSignature);
            sConstructorMap.put(name, constructor);
        }
        constructor.setAccessible(true);
        return constructor.newInstance(mConstructorArgs);
    } catch (Exception e) {
        // We do not want to catch these, lets return null and let the actual LayoutInflater
        // try
        return null;
    }
}
 
開發者ID:L-value,項目名稱:Android-Plugin-Framework,代碼行數:22,代碼來源:PluginViewInflater.java


注:本文中的android.view.InflateException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。