Приложение перезагружается при использовании AutoSizeColumn () листаJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Приложение перезагружается при использовании AutoSizeColumn () листа

Сообщение Anonymous »

Когда я включаю AutoSizeCloumn () Мое приложение, если перезагрузка добавить od file создается в каталоге. Если я использую setColumWidth () вручную для каждого столбца, он работает нормально < /p>

my logcat: < /p>
2019-02-21 22:54:59.448 4410-4410/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
2019-02-21 22:54:59.463 4410-4410/? D/AccessibilityManager: current package=com.example.railway, accessibility manager mIsFinalEnabled=true, mOptimizeEnabled=false, mIsUiAutomationEnabled=false, mIsInterestedPackage=true
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void com.example.railway.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:16)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6845)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1119)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2700)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2808)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1541)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.os.Looper.loop() (Looper.java:165)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6375)
2019-02-21 22:54:59.484 4410-4410/com.example.railway I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:912)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:802)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.example.railway-1/base.apk", zip file "/data/app/com.example.railway-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.railway-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.railway-1/lib/
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:74)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2203)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:637)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void com.example.railway.MainActivity.onCreate(android.os.Bundle) (MainActivity.java:16)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6845)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1119)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2700)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2808)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1541)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.os.Looper.loop() (Looper.java:165)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6375)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:912)
2019-02-21 22:54:59.485 4410-4410/com.example.railway I/art: at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:802)
2019-02-21 22:54:59.571 4410-4410/com.example.railway E/HAL: PATH3 /odm/lib64/hw/gralloc.qcom.so
2019-02-21 22:54:59.571 4410-4410/com.example.railway E/HAL: PATH2 /vendor/lib64/hw/gralloc.qcom.so
2019-02-21 22:54:59.571 4410-4410/com.example.railway E/HAL: PATH1 /system/lib64/hw/gralloc.qcom.so
2019-02-21 22:54:59.571 4410-4410/com.example.railway E/HAL: PATH3 /odm/lib64/hw/gralloc.msm8953.so
2019-02-21 22:54:59.571 4410-4410/com.example.railway E/HAL: PATH2 /vendor/lib64/hw/gralloc.msm8953.so
2019-02-21 22:54:59.571 4410-4410/com.example.railway E/HAL: PATH1 /system/lib64/hw/gralloc.msm8953.so
< /code>

my code < /p>

Код: Выделить всё

public class Excel {

public boolean saveExcelFile(Context context,String filename) {

// check if available and not read only
if (!isExternalStorageAvailable() || isExternalStorageReadOnly()) {
Log.d("FileUtils", "Storage not available or read only");
return false;
}

boolean success = false;

//New Workbook
Workbook wb = new HSSFWorkbook();

Sheet sheet = wb.createSheet("Sheet");

//BEggining of heading
Row rowhead = sheet.createRow(9);
Cell cell1  = rowhead.createCell( 0);
Cell cell2  = rowhead.createCell( 1);
Cell cell3  = rowhead.createCell( 2);
Cell cell4  = rowhead.createCell( 3);
Cell cell5  = rowhead.createCell( 4);
Cell cell6  = rowhead.createCell( 5);
Cell cell7  = rowhead.createCell( 6);
Cell cell8  = rowhead.createCell( 7);
Cell cell9 = rowhead.createCell(8);
cell1.setCellValue("DATE");
cell2.setCellValue("TRAIN NO");
cell3.setCellValue("LOCO NO");
cell4.setCellValue("From");
cell5.setCellValue("TO");
cell6.setCellValue("COD/DEP");
cell7.setCellValue("ARR");
cell8.setCellValue("LOCOPILOT");
cell9.setCellValue("REMARKS");

// head file
Row row     = sheet.createRow(1);
Cell cell   = row.createCell(0);
cell.setCellValue("SOUTH CENTRAL RAILWAY \n VIJAYAWDA\n DAILYWISE STATEMENT FOR THE MONTH OF"+filename+
"\nNAME:G.SRNIVASA RAO  DESIGN:CLI  HQRS:RJY \nPF.NO:09327885  PAY:Rs.88700");
CellStyle cs = wb.createCellStyle();
cs.setVerticalAlignment(VerticalAlignment.CENTER);
cs.setWrapText(true);
cell.setCellStyle(cs);
row.setHeightInPoints((5*sheet.getDefaultRowHeightInPoints()));
sheet.addMergedRegion(new CellRangeAddress(1,4,0,9));
CellUtil.setAlignment(cell, HorizontalAlignment.CENTER);
// end of head file

for (int i =0 ;i< 9;i++)
{
sheet.autoSizeColumn(i,true);
}

// Create a path where we will place our List of objects on external storage
File file = new File(context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS),filename+".xls");
FileOutputStream os = null;

try {
os = new FileOutputStream(file);
wb.write(os);
Log.d("FileUtils", "Writing file" + file);
success = true;
} catch (IOException e) {
Log.d("FileUtils", "Error writing "  + file, e);
} catch (Exception e) {
Log.d("FileUtils", "Failed to save file", e);
} finally {
try {
if (null != os)
os.close();
} catch (Exception ex) {
}
}

return success;
}

public static boolean isExternalStorageReadOnly() {
String extStorageState = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) {
return true;
}
return false;
}

public static boolean isExternalStorageAvailable() {
String extStorageState = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(extStorageState)) {
return true;
}
return false;
}
}
Initially though it was because of merged cells,so removed and tried again still app is restarting and file is not creating.
Searched in internet and some results mentioned its because of 'Font' so even tried it and if I font to arial, bold again app is restarting without file creation
New to apache
please correct me if there is Любая ошибка в коде или лучший способ сделать это
Заранее :)

Подробнее здесь: https://stackoverflow.com/questions/548 ... mn-is-used
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Приложение перезагружается при использовании AutoSizeColumn () листа
    Anonymous » » в форуме JAVA
    0 Ответы
    3 Просмотры
    Последнее сообщение Anonymous
  • Android POI: сбой при использовании autoSizeColumn()
    Гость » » в форуме JAVA
    0 Ответы
    15 Просмотры
    Последнее сообщение Гость
  • Android POI: сбой при использовании autoSizeColumn()
    Гость » » в форуме Android
    0 Ответы
    14 Просмотры
    Последнее сообщение Гость
  • Apache POI autoSizeColumn неправильно изменяет размер
    Anonymous » » в форуме JAVA
    0 Ответы
    11 Просмотры
    Последнее сообщение Anonymous
  • Apache POI autoSizeColumn неправильно изменяет размер
    Anonymous » » в форуме JAVA
    0 Ответы
    10 Просмотры
    Последнее сообщение Anonymous

Вернуться в «JAVA»