sean
sean

Reputation: 133

Listview crashed after launch

My application crashes moments after my list-view is launched. My listview is the fist activity ran in the program. I have no compiling errors and do not understand the logcat errors received. I think the issue may be in my manifest. Any assistance would be appreciated. Below is my logcat and manifest.

Logcat:

 07-16 22:42:55.129: E/AndroidRuntime(1448): FATAL EXCEPTION: ModernAsyncTask #1
 07-16 22:42:55.129: E/AndroidRuntime(1448): java.lang.RuntimeException: An error occured while executing doInBackground()
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.lang.Thread.run(Thread.java:856)
07-16 22:42:55.129: E/AndroidRuntime(1448): Caused by: java.lang.SecurityException: Permission Denial: opening provider com.loginplus.home.ListProvider from ProcessRecord{41c4be20 1448:com.example.listviewrefresh/10041} (pid=1448, uid=10041) that is not exported from uid 10040
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.os.Parcel.readException(Parcel.java:1327)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.os.Parcel.readException(Parcel.java:1281)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:2201)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.app.ActivityThread.acquireProvider(ActivityThread.java:4024)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:1612)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.content.ContentResolver.acquireProvider(ContentResolver.java:918)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.content.ContentResolver.query(ContentResolver.java:305)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:240)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)
07-16 22:42:55.129: E/AndroidRuntime(1448):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-16 22:42:55.129: E/AndroidRuntime(1448):     ... 4 more

Listview activity:

 public class LoginList extends FragmentActivity implements   AdapterView.OnItemClickListener, OnClickListener, LoaderManager.LoaderCallbacks<Cursor> {

private ListView loginList;
private Button webLogin;
private SimpleCursorAdapter adapter;

@Override 
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_listview);

loginList = (ListView)findViewById(R.id.loginlist);
loginList.setOnItemClickListener(this);

webLogin = (Button)findViewById(R.id.button3);
webLogin.setOnClickListener(this);



//Specify fields to display in the list
String[] from = new String[] {ListProvider.COLUMN_NAME_SITE};

//Bind fields to listview
int[] to = new int[] {R.id.loginlist};

// Create CursorAdapter and set it to display
adapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_1, null, from, to, 0 );

loginList.setAdapter(adapter);

getSupportLoaderManager().initLoader( 0, null, this);
}



@Override
public void onItemClick(AdapterView<?> l, View v, int position, long id) {

// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "Selected ID :" + position, Toast.LENGTH_SHORT).show();

Intent updateDeleteLoginInfo = new Intent (this, UpdateDeleteLoginList.class);

Cursor clickedObject = (Cursor)loginList.getItemAtPosition(0);

Bundle loginBundle = new Bundle();
loginBundle.putString("clickedWebSite",((LoginDetails) clickedObject).getsName());
loginBundle.putString("clickedWebAddress",((LoginDetails) clickedObject).getwUrl());
loginBundle.putString("clickedUserName",((LoginDetails) clickedObject).getuName());
loginBundle.putString("clickedPassWord",((LoginDetails) clickedObject).getpWord());
loginBundle.putString("clickedNotes",((LoginDetails) clickedObject).getlNotes());

updateDeleteLoginInfo.putExtras(loginBundle);

startActivityForResult(updateDeleteLoginInfo, 0); 
} 

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent webLoginIntent = new Intent (this, LoginPlusActivity.class);
startActivity(webLoginIntent);
}

 @Override
 public Loader<Cursor> onCreateLoader(int ignored, final Bundle args) {

String [] columns = { ListProvider.COLUMN_ROWID, ListProvider.COLUMN_NAME_SITE};
CursorLoader cursorloader = new CursorLoader(this, ListProvider.CONTENT_URI, columns, null, null, null);

return cursorloader;
}

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
adapter.swapCursor(cursor);
}

@Override
public void onLoaderReset (Loader<Cursor> loader) {
adapter.swapCursor(null);
}
}    

manifest:

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.listviewrefresh"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name=".LoginList"
        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=".LoginDB"
        android:label="@string/app_name" >
        <intent-filter >
            <action android:name="com.example.listviewrefresh.LOGINDB" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".LoginDetails"
        android:label="@string/app_name" >
        <intent-filter >
            <action android:name="com.example.listviewrefresh.LOGINDETAILS" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".UpdateDeleteLoginList"
        android:label="@string/app_name" >
        <intent-filter >
            <action android:name="com.example.listviewrefresh.UPDATEDELETELOGINLIST" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".LoginPlusActivity"
        android:label="@string/app_name" >
        <intent-filter >
            <action android:name="com.example.listviewrefresh.LOGINPLUSACTIVITY" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".dataStore"
        android:label="@string/app_name" >
        <intent-filter >
            <action android:name="com.example.listviewrefresh.DATASTORE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <provider
android:authorities="com.example.listviewrefresh.ListProvider"
android:multiprocess="true"
android:exported="false"
android:readPermission="com.example.listviewrefresh.ListProvider.READ_DATABASE"
android:writePermission="com.example.listviewrefresh.ListProvider.WRITE_DATABASE"
android:name="com.example.listviewrefresh.ListProvider"></provider>       
</application>
</manifest>

Upvotes: 0

Views: 787

Answers (2)

rharter
rharter

Reputation: 2495

This kind of looks like you might be porting an app, no?

Without seeing the details of the ListProvider class you're using we can't know for sure, but it looks like your ListProvider.CONTENT_URI is the wrong URI.

The error message is saying that you can't access com.loginplus.home.ListProvider, not com.example.listviewrefresh.ListProvider which is in your manifest.

If that is, in fact, a content provider from another application, it will error like this if the android:exported attribute is false.

To fix it, just update your ListProvider.CONTENT_URI to match the one in the manifest or, if you are trying to talk to another app, add android:exported=true to the other app's content provider.

Upvotes: 1

Rajeev
Rajeev

Reputation: 1404

As per the logcat

07-16 22:42:55.129: E/AndroidRuntime(1448): Caused by: java.lang.SecurityException: Permission Denial: opening provider com.loginplus.home.ListProvider from ProcessRecord{41c4be20 1448:com.example.listviewrefresh/10041} (pid=1448, uid=10041) that is not exported from uid 10040

It is trying to open some provider(com.loginplus.home.ListProvider) which I cannot see in your manifest.

Ideally it should have been opening com.example.listviewrefresh.ListProvider, do you have any other provider?

Upvotes: 1

Related Questions