| | |
| | | import android.content.Context; |
| | | import android.content.res.Resources; |
| | | import android.os.Environment; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | |
| | | |
| | | } |
| | | |
| | | public static StringBuffer readTxtFileFromSD(Context context,String fileName){ |
| | | public static StringBuffer readTxtFileFromSD(Context context,String fileName,boolean isRootDir){ |
| | | String lineTxt = null; |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | try { |
| | | String dir = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"; |
| | | InputStream inputStream = null; |
| | | String dir = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+context.getPackageName(); |
| | | if (isRootDir){ |
| | | |
| | | }else{ |
| | | |
| | | dir = dir+context.getPackageName(); |
| | | } |
| | | File file = new File(dir,fileName); |
| | | if (!file.exists()){ |
| | | MyLog.d(TAG,fileName+"文件不存在"); |
| | | MyLog.d(TAG,dir+"目录下"+fileName+"文件不存在"); |
| | | return null; |
| | | } |
| | | try { |