|
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.projekat/com.example.projekat.EmailsActivity}: java.lang.IllegalArgumentException: Unknown URI: content:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2805)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2883)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1613)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:445)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
Caused by: java.lang.IllegalArgumentException: Unknown URI: content:
at com.example.projekat.database.ContactsDBContentProvider.insert(ContactsDBContentProvider.java:79)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:265)
at android.content.ContentResolver.insert(ContentResolver.java:1539)
at com.example.projekat.tools.EmailsUtil.InitDB(EmailsUtil.java:23)
at com.example.projekat.EmailsActivity.onCreate(EmailsActivity.java:73)
at android.app.Activity.performCreate(Activity.java:7109)
at android.app.Activity.performCreate(Activity.java:7100)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2758)
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.projekat">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_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">
<service android:name=".sync.SyncSerivce" />
<receiver android:name=".sync.SyncReciever" />
<activity android:name=".MainActivity"></activity>
<activity
android:name=".SplashActivity"
android:label="Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LogInActivity"
android:label="Login activity" />
<activity
android:name=".ContactActivity"
android:label="Contact"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".CreateContactActivity"
android:label="Create contact"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".ContactsActivity"
android:label="Contacts"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".ProfileActivity"
android:label="Profile"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".SettingsActivity"
android:label="Settings"
android:parentActivityName=".MainActivity"></activity>
<activity
android:name=".FolderActivity"
android:label="Folder"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".FoldersActivity"
android:label="Folders"
android:parentActivityName=".EmailsActivity" />
<activity
android:name=".EmailActivity"
android:label="Email"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".EmailsActivity"
android:label="Emails"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".CreateFolderActivity"
android:label="Create folder"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<activity
android:name=".CreateEmailActivity"
android:label="Create Email"
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<provider
android:authorities="com.example.projekat"
android:name="com.example.projekat.database.ContactsDBContentProvider"
android:exported ="false"/>
<provider
android:authorities="com.example.projekat"
android:name="com.example.projekat.database.EmailsDBContentProvider"
android:exported ="false"/>
</application>
</manifest>
public class EmailsDBContentProvider extends ContentProvider {
private EmailsSQLiteHelper database;
private static final int EMAILS = 11;
private static final int EMAILS_ID = 21;
private static final String AUTHORITY = "com.example.projekat";
private static final String EMAILS_PATH = "emails.db";
public static final Uri CONTENT_URI_EMAILS = Uri.parse("content://" + AUTHORITY + "/" + EMAILS_PATH);
private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
static {
sURIMatcher.addURI(AUTHORITY, EMAILS_PATH, EMAILS);
sURIMatcher.addURI(AUTHORITY, EMAILS_PATH + "/#", EMAILS_ID);
}
@Override
public boolean onCreate() {
database = new EmailsSQLiteHelper(getContext());
return true;
}
@Nullable
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
int uriType = sURIMatcher.match(uri);
switch (uriType) {
case EMAILS_ID:
queryBuilder.appendWhere(EmailsSQLiteHelper.COLUMN_ID + "="
+ uri.getLastPathSegment());
case EMAILS:
queryBuilder.setTables(EmailsSQLiteHelper.TABLE_EMAILS);
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
SQLiteDatabase db = database.getWritableDatabase();
Cursor cursor = queryBuilder.query(db, projection, selection,
selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
@Nullable
@Override
public String getType(Uri uri) {
return null;
}
@Nullable
@Override
public Uri insert(Uri uri, ContentValues values) {
Uri retVal = null;
int uriType = sURIMatcher.match(uri);
SQLiteDatabase sqlDB = database.getWritableDatabase();
long id = 0;
switch (uriType) {
case EMAILS:
id = sqlDB.insert(EmailsSQLiteHelper.TABLE_EMAILS, null, values);
retVal = Uri.parse(EMAILS_PATH + "/" + id);
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return retVal;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
int uriType = sURIMatcher.match(uri);
SQLiteDatabase sqlDB = database.getWritableDatabase();
long id = 0;
int rowsDeleted = 0;
switch (uriType) {
case EMAILS:
rowsDeleted = sqlDB.delete(EmailsSQLiteHelper.TABLE_EMAILS,
selection,
selectionArgs);
break;
case EMAILS_ID:
String idEmails = uri.getLastPathSegment();
if (TextUtils.isEmpty(selection)) {
rowsDeleted = sqlDB.delete(EmailsSQLiteHelper.TABLE_EMAILS,
EmailsSQLiteHelper.COLUMN_ID + "=" + idEmails,
null);
} else {
rowsDeleted = sqlDB.delete(EmailsSQLiteHelper.TABLE_EMAILS, EmailsSQLiteHelper.COLUMN_ID + "=" + idEmails
+ " and "
+ selection, selectionArgs);
}
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return rowsDeleted;
}
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
int uriType = sURIMatcher.match(uri);
SQLiteDatabase sqlDB = database.getWritableDatabase();
long id = 0;
int rowsUpdated = 0;
switch (uriType) {
case EMAILS:
rowsUpdated = sqlDB.update(EmailsSQLiteHelper.TABLE_EMAILS,
values,
selection,
selectionArgs);
break;
case EMAILS_ID:
String idEmails = uri.getLastPathSegment();
if (TextUtils.isEmpty(selection)) {
rowsUpdated = sqlDB.update(EmailsSQLiteHelper.TABLE_EMAILS,
values,
EmailsSQLiteHelper.COLUMN_ID + "=" + idEmails,
null);
} else {
rowsUpdated = sqlDB.update(EmailsSQLiteHelper.TABLE_EMAILS,
values,
EmailsSQLiteHelper.COLUMN_ID + "=" + idEmails
+ " and "
+ selection,
selectionArgs);
}
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return rowsUpdated;
}
}
public class EmailsSQLiteHelper extends SQLiteOpenHelper {
public static final String TABLE_EMAILS = "Emails";
public static final String COLUMN_ID = "id";
public static final String COLUMN_OD = "od";
public static final String COLUMN_DATETIME = "dateTime";
public static final String COLUMN_SUBJECT = "Subject";
public static final String COLUMN_CONTENT = "Content";
public static final String COLUMN_AVATAR = "avatar";
private static final String DATABASE_NAME = "emails.db";
private static final int DATABASE_VERSION = 1;
private static final String DB_CREATE = "create table "
+ TABLE_EMAILS + "("
+ COLUMN_ID + " integer primary key autoincrement, "
+ COLUMN_OD + " text, "
+ COLUMN_DATETIME + " text, "
+ COLUMN_SUBJECT + " text, "
+ COLUMN_CONTENT + " text, "
+ COLUMN_AVATAR + " integer "
+ ")";
public EmailsSQLiteHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(DB_CREATE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_EMAILS);
onCreate(db);
}
}
|
|
|
|
|
At a guess, since you have not shown where the error occurs, it is in the following block of your code:
switch (uriType) {
case EMAILS_ID:
queryBuilder.appendWhere(EmailsSQLiteHelper.COLUMN_ID + "="
+ uri.getLastPathSegment());
case EMAILS:
queryBuilder.setTables(EmailsSQLiteHelper.TABLE_EMAILS);
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
So you need to find out what value is in the uriType variable, and why.
|
|
|
|
|
Hi everybody. I'm a new android learner I'm doing a project related to sqlite, I have 2 data sheets
a table contains folder names a table contains items 2 of these tables linked together by a foreign key. I don't know how to dis play folders and items on recyclview please help me
|
|
|
|
|
Member 14849785 wrote: I don't know how to dis play folders and items on recyclview Do you have an adapter bound to this view?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Here fl_iv is the frame layout containing the imageview which showcases the image. I have set up a button there which allows user to use the image as LOCK SCREEN wallpaper. id of that button is lock_screen. Please try to be descriptive as i am new to this language
I tried this code for lock screen but its not working.
lock_screen.setOnClickListener {
val wpManager = WallpaperManager.getInstance(this)
val myBitmap: Bitmap = fl_iv.drawToBitmap()
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
wpManager.setBitmap(myBitmap, null, true, WallpaperManager.FLAG_LOCK)
}
else{
return@setOnClickListener
}
} catch (ex: IOException) {
ex.printStackTrace()
}
}
|
|
|
|
|
VipulSh wrote: but its not working Unfortunately that does not explain what your problem is. Please edit your question and explain what happens when you run your code (assuming it is your code, and not something downloaded from the internet).
|
|
|
|
|
Yea i tried to write it according to android documentation. It does nothing. Not even an error. It just doesn't do anything. I want to click it and set my bitmap image as lock screen wallpaper but nothing happens. What i should change in it to make it work for me?
|
|
|
|
|
Sorry, no idea. The only way to find out what is happening is by using the debugger. Something in your code must be wrong, or using the system in the wrong way.
|
|
|
|
|
It would have been easier if logcat actually declared some error. but as no error is showing up idk whats happening
|
|
|
|
|
Have you actually stepped through the code in the debugger to see if it does make the call to wpManager.setBitmap ? Also why are you not checking the return value from that call to see whether it succeeded or not?
|
|
|
|
|
I'm going to be starting a Xamarin Forms app for a client. There will be around 10 users, and I need to install and periodically update them. This app will NOT be for sale and NOT available to anyone outside their organization.
My question is, how do I publish the app? I found this page, and it mentions "Download from server", which seems like what I want, but there's no info on how to do that?
Can someone shed some light on this? Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
THanks Richard. That was a lot of help.
Have you done this before? I have some questions and I keep getting stuck
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I haven't done any Xamarin yet, so I'm not likely to be able to provide much help.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello everyone.
In order to develop Android programms, I am using IntelliJ IDEA 2020 (x64) on Windows 10 that is running on Intel core 2 Duo processor.
To debug and run the app, I use the Nexus 5 hardware and Nougat x86 System Image (API Level 24).
Also I’ve checked Intel x86 Emulator Accelerator (HAXM Installer) in SDK Tools and enabled Virtualization Tech in System BIOS.
After running the app, Device is shown to me, but my app doesn’t exist in it and this message pops up:
Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release.
Please help me.
|
|
|
|
|
Pouria Polouk wrote: We will address this in a future release. What part of that message do you not understand?
|
|
|
|
|
All of the message!
And why doesn't the App run on my CPU?
|
|
|
|
|
Have you seen here?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Yes, unfortunately it doesn't work for me.
|
|
|
|
|
Pouria Polouk wrote: And why doesn't the App run on my CPU? For exactly the reasons stated in the message.
|
|
|
|
|
Are there any other solutions OR changing the CPU is the only option?
|
|
|
|
|
If there was then there would be no need for that message.
|
|
|
|
|
Are you making fun of my question!?
|
|
|
|
|
Pouria Polouk wrote: Are you making fun of my question!? Not likely. I think we are confused as to what you want us to do.
Contact the vendor and see what they say.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
No, I am trying to get you to understand that the message produced by IntelliJ is telling you that something will not work on your system. And as they say, "A CPU with EPT + UG features is currently needed. We will address this in a future release.". So you need to upgrade your CPU or wait for them to release the version which does support it. But either way they are the people you should be talking to about the issue.
|
|
|
|