Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 Naver Business Platform Corp. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /
package com.handmark.pulltorefresh.configuration.xml;
Parser of assets/pulltorefresh.xml creation factory

Wonjun Kim
	private static final String LOG_TAG = ExtendedConfigXmlParserFactory.class.getName();
pulltorefresh.xml path in assets folder
	private static final String XML_PATH_IN_ASSETS = "pulltorefresh.xml";
pulltorefresh.xml encoding type
	private static final String DEFAULT_ENCODING_TYPE = "utf-8";
Create a parser of assets/pulltorefresh.xml

parser if creating parser has done, or null if an error occured during creation
	public static XmlPullParser createParser(Context context) {
		AssetManager am = context.getAssets();
		XmlPullParser parser = null;
		try {
			parser = XmlPullParserFactory.newInstance().newPullParser();
catch (FileNotFoundException e) {
			Log.d("The configuration file 'assets/" +  + "' is missing. But the file is just an option. It is necessary only if you want to customize something in Pull To Refresh.");
			// explicitly assign null
			parser = null;
catch (XmlPullParserException e) {
			Log.w("The error occurs below when generating parser."e);
			// explicitly assign null
			parser = null;
catch (IOException e) {
			Log.w("Loading "++" file has failed."e);
			// explicitly assign null
			parser = null;
		// NOTE: this code makes a fatal error. so omit the code.
		// am.close();
		return parser;
New to GrepCode? Check out our FAQ X