teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

8

2021/09/26 11:13

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,7 @@
7
7
  ### 追加したimport文章
8
8
  ```ここに言語を入力
9
9
 
10
- import nl.diviwork.minenation.objects ActionDB;
10
+ import nl.diviwork.minenation.objects.ActionDB;
11
11
  ```
12
12
 
13
13
  ### 作成したJavaファイル全文

7

2021/09/26 11:13

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
@@ -61,59 +61,4 @@
61
61
  }
62
62
  }
63
63
 
64
- ```
65
-
66
- ### 作成したbuilding.gradle全文
67
- ```ここに言語を入力
68
-
69
- plugins {
70
- id 'com.android.application'
71
- id 'kotlin-android'
72
- }
73
-
74
- android {
75
- compileSdkVersion 31
76
- buildToolsVersion "30.0.3"
77
-
78
- defaultConfig {
79
- applicationId "com.example.excelteratail"
80
- minSdkVersion 16
81
- targetSdkVersion 30
82
- versionCode 1
83
- versionName "1.0"
84
-
85
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
86
- }
87
-
88
- buildTypes {
89
- release {
90
- minifyEnabled false
91
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
92
- }
93
- }
94
- compileOptions {
95
- sourceCompatibility JavaVersion.VERSION_1_8
96
- targetCompatibility JavaVersion.VERSION_1_8
97
- }
98
- kotlinOptions {
99
- jvmTarget = '1.8'
100
- }
101
- }
102
-
103
- dependencies {
104
- compile 'org.apache.poi-bin-3.0-FINAL-20070503'
105
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
106
- implementation 'androidx.core:core-ktx:1.6.0'
107
- implementation 'androidx.appcompat:appcompat:1.3.1'
108
- implementation 'com.google.android.material:material:1.4.0'
109
- implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
110
- implementation files('libs\poi-3.0-rc4-20070503.jar')
111
- implementation files('libs\poi-contrib-3.0-rc4-20070503.jar')
112
- implementation files('libs\poi-scratchpad-3.0-rc4-20070503.jar')
113
- testImplementation 'junit:junit:4.+'
114
- androidTestImplementation 'androidx.test.ext:junit:1.1.3'
115
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
116
- // implementation 'org.apache.poi:poi-ooxml:3.0'
117
- }
118
-
119
64
  ```

6

2021/09/26 06:54

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,4 @@
1
- AndroidStudioにてActionDBクラスをimportしたいのですが上手くいきません。building.grade ではsuccessメッセージがでたので、こちらのjavaファイルでのimportの書き方の問題かと思うのですが...以下のURLのソースクラスのimportのみ追加して、building.gradleファイルは質問者様のやり方でsuccessとメッセージがでたので問題ないかと考えました。
1
+ AndroidStudioにてActionDBクラスをimportしたいのですが上手くいきません。building.grade ではsuccessメッセージがでたので問題なく、こちらのjavaファイルでのimportの書き方の問題かと思うのですが別の書き方があるのでしょうか。以下のURLのソースクラスのimportのみ追加しました。
2
2
 
3
3
  Poiライブラリ取り込みExcelと連携するアプリです。
4
4
 
@@ -8,4 +8,112 @@
8
8
  ```ここに言語を入力
9
9
 
10
10
  import nl.diviwork.minenation.objects ActionDB;
11
+ ```
12
+
13
+ ### 作成したJavaファイル全文
14
+ ```ここに言語を入力
15
+
16
+ package com.example.overseapoi;
17
+
18
+ import android.content.ContentValues;
19
+ import android.util.Log;
20
+ import androidx.appcompat.app.AppCompatActivity;
21
+ import org.apache.poi.ss.usermodel.Cell;
22
+ import org.apache.poi.ss.usermodel.Row;
23
+ import org.apache.poi.ss.usermodel.Sheet;
24
+ import java.util.Iterator;
25
+ import nl.diviwork.minenation.objects.ActionDB;
26
+
27
+ public class Import2SQLite extends AppCompatActivity {
28
+
29
+ public static final String DNN = "DO";// 0 text(String)
30
+ public static final String ITT = "IT";// 1 integer
31
+ public static final String DNQ = "DN";// 2 text(String)
32
+
33
+
34
+ public static void ExcelToSqlite(ActiononDB dbAdapter, Sheet sheet) {
35
+
36
+
37
+ for (Iterator<Row> rit = sheet.rowIterator();
38
+ rit.hasNext(); ) {
39
+ Row row = rit.next();
40
+
41
+ ContentValues contentValues = new ContentValues();
42
+
43
+ row.getCell(0, Row.CREATE_NULL_AS_BLANK).setCellType(Cell.CELL_TYPE_STRING);
44
+ row.getCell(1, Row.CREATE_NULL_AS_BLANK).setCellType(Cell.CELL_TYPE_STRING);
45
+ row.getCell(2, Row.CREATE_NULL_AS_BLANK).setCellType(Cell.CELL_TYPE_STRING);
46
+
47
+
48
+ contentValues.put(DNN, row.getCell(0, Row.CREATE_NULL_AS_BLANK).getStringCellValue());
49
+ contentValues.put(ITT, row.getCell(1, Row.CREATE_NULL_AS_BLANK).getStringCellValue());
50
+ contentValues.put(DNQ, row.getCell(2, Row.CREATE_NULL_AS_BLANK).getStringCellValue());
51
+
52
+ try {
53
+ if (dbAdapter.insert("Usertypes", contentValues) < 0) {
54
+ return;
55
+ }
56
+
57
+ } catch (Exception ex) {
58
+ Log.d("Exception in importing", ex.getMessage());
59
+ }
60
+ }
61
+ }
62
+ }
63
+
64
+ ```
65
+
66
+ ### 作成したbuilding.gradle全文
67
+ ```ここに言語を入力
68
+
69
+ plugins {
70
+ id 'com.android.application'
71
+ id 'kotlin-android'
72
+ }
73
+
74
+ android {
75
+ compileSdkVersion 31
76
+ buildToolsVersion "30.0.3"
77
+
78
+ defaultConfig {
79
+ applicationId "com.example.excelteratail"
80
+ minSdkVersion 16
81
+ targetSdkVersion 30
82
+ versionCode 1
83
+ versionName "1.0"
84
+
85
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
86
+ }
87
+
88
+ buildTypes {
89
+ release {
90
+ minifyEnabled false
91
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
92
+ }
93
+ }
94
+ compileOptions {
95
+ sourceCompatibility JavaVersion.VERSION_1_8
96
+ targetCompatibility JavaVersion.VERSION_1_8
97
+ }
98
+ kotlinOptions {
99
+ jvmTarget = '1.8'
100
+ }
101
+ }
102
+
103
+ dependencies {
104
+ compile 'org.apache.poi-bin-3.0-FINAL-20070503'
105
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
106
+ implementation 'androidx.core:core-ktx:1.6.0'
107
+ implementation 'androidx.appcompat:appcompat:1.3.1'
108
+ implementation 'com.google.android.material:material:1.4.0'
109
+ implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
110
+ implementation files('libs\poi-3.0-rc4-20070503.jar')
111
+ implementation files('libs\poi-contrib-3.0-rc4-20070503.jar')
112
+ implementation files('libs\poi-scratchpad-3.0-rc4-20070503.jar')
113
+ testImplementation 'junit:junit:4.+'
114
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
115
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
116
+ // implementation 'org.apache.poi:poi-ooxml:3.0'
117
+ }
118
+
11
119
  ```

5

2021/09/26 06:52

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
File without changes

4

2021/09/26 06:52

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,7 @@
1
- ActionDBクラスをimportしたいのですが上手くいきません。building.grade ではsuccessメッセージがでたので、こちらのjavaファイルでの問題かと思うのですが...以下のURLのソースほぼ修正せず、import部分だけ持ってきまた。Poiラブラリ取込みExcel連携するアプリ
1
+ AndroidStudioにてActionDBクラスをimportしたいのですが上手くいきません。building.grade ではsuccessメッセージがでたので、こちらのjavaファイルでのimportの書き方の問題かと思うのですが...以下のURLのソースクラスのimportのみ追加て、building.gradleファルは質問者様のや方でsuccessメッセージがたので問題ないかと考えました
2
2
 
3
+ Poiライブラリ取り込みExcelと連携するアプリです。
4
+
3
5
  海外AndroidPoi開発
4
6
  https://stackoverflow.com/questions/63546594/reading-xssf-workbook-xlsx-crashes-android-app
5
7
  ### 追加したimport文章

3

2021/09/26 06:31

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
File without changes

2

2021/09/26 06:27

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
@@ -1,1 +1,1 @@
1
- ActionDBクラスのimport
1
+ ActionDBクラスのimportの記述について
body CHANGED
File without changes

1

2021/09/26 06:27

投稿

2r4h8k3m
2r4h8k3m

スコア22

title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,9 @@
1
- ActionDBクラスをimportしたいのですが上手くいきません。building.grade ではsuccessメッセージがでたので、こちらのjavaファイルでの問題かと思うのですが...Poiライブラリ取り込みExcelと連携するアプリです。
1
+ ActionDBクラスをimportしたいのですが上手くいきません。building.grade ではsuccessメッセージがでたので、こちらのjavaファイルでの問題かと思うのですが...以下のURLのソースほぼ修正せず、import部分だけ持ってきました。Poiライブラリ取り込みExcelと連携するアプリです。
2
+
3
+ 海外AndroidPoi開発
4
+ https://stackoverflow.com/questions/63546594/reading-xssf-workbook-xlsx-crashes-android-app
5
+ ### 追加したimport文章
2
6
  ```ここに言語を入力
3
7
 
4
8
  import nl.diviwork.minenation.objects ActionDB;
5
- ```
9
+ ```
6
- 海外AndroidPoi開発
7
- https://stackoverflow.com/questions/63546594/reading-xssf-workbook-xlsx-crashes-android-app