Tiago Alexander
asked on
problem with android.database.sqlite.SQLiteException android.database.sqlite.SQLiteException: no such table: Table_name Query
i'm very new to android... but i have a lot experience in programming with PHP(9+ years) and quite a lot but no so much in Java (~3+years)
i just want to create an app that connects to an api (with login and logout), but before that i have to make it offline, i mean using SQLite in order to READ the data (login)
i'm facing a problem that i cannot access to the database sqlite which i already create using sqllite browser using the folloing line
i just want to create an app that connects to an api (with login and logout), but before that i have to make it offline, i mean using SQLite in order to READ the data (login)
i'm facing a problem that i cannot access to the database sqlite which i already create using sqllite browser using the folloing line
SQLiteDatabase mydatabase = openOrCreateDatabase("test.db", MODE_PRIVATE, null);
i cannot read the user and my app just get out alone
For external storage, you need the following permissions:
<uses-permission android:name="android.perm ission.WRI TE_EXTERNA L_STORAGE" />
<uses-permission android:name="android.perm ission.REA D_EXTERNAL _STORAGE" />
<uses-permission android:name="android.perm
<uses-permission android:name="android.perm
here is a good tutorial:
https://www.tutorialspoint.com/android/android_sqlite_database.htm
https://www.tutorialspoint.com/android/android_sqlite_database.htm
ASKER
i have the following code
this method which is boolean is where i pass it the username and password as normal strings... (wihout hashing) and after making or telling me that the user should write a username and password
PLEASE HELP
private boolean isUserAndPassBoolean(String username001, String passwd) {
SQLiteDatabase mydatabase = openOrCreateDatabase("test.db", MODE_ENABLE_WRITE_AHEAD_LOGGING, null);
Cursor resultSet = mydatabase.rawQuery("SELECT * FROM usuarios WHERE user LIKE '" + username001.toString() + "' AND password LIKE '" + passwd.toString() + "'", null);
resultSet.moveToFirst();
String username = resultSet.getString(0);
String password02 = resultSet.getString(1);
if ((username001 == username) && (password02 == passwd)) {
return true;
} else {
return false;
//focusView.requestFocus();
}
//return false;
}
the emulator said me that i have to unistall the previous appthis method which is boolean is where i pass it the username and password as normal strings... (wihout hashing) and after making or telling me that the user should write a username and password
PLEASE HELP
ASKER
IT TAKES GOOD THE LAYOUT AND THE ACTIVITY... I ALREADY DID IN THE ANDROID MANIFEST THE LINES YOU TOLD ME
IT NOW SAYS
IT NOW SAYS
10-17 11:01:43.476 1198-1198/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ejemplo.aplicacion, PID: 1198
android.database.sqlite.SQLiteException: no such table: usuarios (code 1): , while compiling: SELECT * FROM usuarios WHERE user LIKE 'CORREO' AND password LIKE 'CONTRASE;A'
ASKER
IN DEED I STARTED WITH THE tutorial you gave me 3 days ago...
here is my android.manifest
here is my android.manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ejemplo001.aplicacioninvertropolis">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".LoginActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".OtraActividad"
android:label="Pantalla de bienvenida..."
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
you could try the following:
1) Settings > Application Manager
2) Select App
3) Clear Data
4) Uninstall App
1) Settings > Application Manager
2) Select App
3) Clear Data
4) Uninstall App
ASKER
i already did that... and it's not working
PLEASE DONT LEAVE ME... i really need this job... please please
i had to restart the machine (windows)...
i tried to implement your solution...
PLEASE DONT LEAVE ME... i really need this job... please please
i had to restart the machine (windows)...
i tried to implement your solution...
ASKER
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Open in new window
hope it helps