Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3490320
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:30:07+00:00 2026-05-18T11:30:07+00:00

Hey, I’m trying to implement two tabs. Each one calls a specifig activity. But

  • 0

Hey, I’m trying to implement two tabs. Each one calls a specifig activity. But when I try to run I have this error:

12-07 20:26:22.164: ERROR/AndroidRuntime(363): FATAL EXCEPTION: main
12-07 20:26:22.164: ERROR/AndroidRuntime(363): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.psyhclo/com.psyhclo.Main}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.psyhclo/com.psyhclo.RatedCalls}: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{405a8ac8 363:com.psyhclo/10030} (pid=363, uid=10030) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.os.Looper.loop(Looper.java:123)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.main(ActivityThread.java:3647)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at java.lang.reflect.Method.invokeNative(Native Method)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at java.lang.reflect.Method.invoke(Method.java:507)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at dalvik.system.NativeStart.main(Native Method)
12-07 20:26:22.164: ERROR/AndroidRuntime(363): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.psyhclo/com.psyhclo.RatedCalls}: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{405a8ac8 363:com.psyhclo/10030} (pid=363, uid=10030) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:1462)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:654)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.widget.TabHost.setCurrentTab(TabHost.java:326)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.widget.TabHost.addTab(TabHost.java:216)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at com.psyhclo.Main.onCreate(Main.java:17)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     ... 11 more
12-07 20:26:22.164: ERROR/AndroidRuntime(363): Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.CallLogProvider from ProcessRecord{405a8ac8 363:com.psyhclo/10030} (pid=363, uid=10030) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.os.Parcel.readException(Parcel.java:1322)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.os.Parcel.readException(Parcel.java:1276)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityManagerProxy.getContentProvider(ActivityManagerNative.java:1882)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.getProvider(ActivityThread.java:3311)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.acquireProvider(ActivityThread.java:3336)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ContextImpl$ApplicationContentResolver.acquireProvider(ContextImpl.java:1634)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.content.ContentResolver.acquireProvider(ContentResolver.java:748)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.content.ContentResolver.query(ContentResolver.java:256)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at com.psyhclo.RatedCalls.onCreate(RatedCalls.java:27)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
12-07 20:26:22.164: ERROR/AndroidRuntime(363):     ... 20 more

Here is the Main.java

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class Main extends TabActivity {

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    TabHost tabHost = getTabHost();
    tabHost.addTab(tabHost.newTabSpec("one").setIndicator("Rated Calls")
            .setContent(new Intent(this, RatedCalls.class)));
    tabHost.addTab(tabHost.newTabSpec("two").setIndicator("Rated Contacts")
            .setContent(new Intent(this, SMS.class)));

    tabHost.setCurrentTab(2);

}

    }

Here is the RatedCalls.java class

import java.text.DateFormat;
import java.util.ArrayList;

import com.psyhclo.R;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class RatedCalls extends Activity {

private static TextView txtView;
private CallDataHelper dh;
StringBuilder sb = new StringBuilder();

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.ratedcalls);        

    //txtView = (TextView) findViewById(R.id.TextView01);
    TextView txtView = new TextView(this);
    Cursor cursor = getContentResolver().query(
            android.provider.CallLog.Calls.CONTENT_URI, null, null, null,
            android.provider.CallLog.Calls.DATE + " DESC ");

    startManagingCursor(cursor);
    int numberColumnId = cursor
            .getColumnIndex(android.provider.CallLog.Calls.NUMBER);
    int durationId = cursor
            .getColumnIndex(android.provider.CallLog.Calls.DURATION);
    int contactNameId = cursor
            .getColumnIndex(android.provider.CallLog.Calls.CACHED_NAME);
    int dateId = cursor.getColumnIndex(android.provider.CallLog.Calls.DATE);
    int numTypeId = cursor.getColumnIndex(android.provider.CallLog.Calls.CACHED_NUMBER_TYPE);

    ArrayList<String> callList = new ArrayList<String>();
    if (cursor.moveToFirst()) {
        do {

            String callerPhoneNumber = cursor.getString(numberColumnId);
            String contactName = cursor.getString(contactNameId);
            String duration = cursor.getString(durationId);
            String callDate = DateFormat.getDateInstance().format(dateId);      
            String numType = cursor.getString(numTypeId);

            //this.dh.insert(1, contactName, callerPhoneNumber, numType, duration, callDate, "01:20");
            Toast.makeText(getBaseContext(), "Inserted!", Toast.LENGTH_LONG);
            callList.add("\nNew Info: \nContact Number: "
                    + callerPhoneNumber + "\nContact Name: " + contactName
                    + "\nDuration: " + duration + "\nDate: " + callDate);

        } while (cursor.moveToNext());
    }
    txtView.setText(callList.toString());
}
    }

And here is the ratedcalls.xml

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />
</LinearLayout>
</TabHost>

And here is the main.xml

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="5dp">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />
</LinearLayout>
</TabHost>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:30:08+00:00Added an answer on May 18, 2026 at 11:30 am

    The log clearly states the problem:

    SecurityException: Permission Denial: opening provider
    com.android.providers.contacts.CallLogProvider requires
    android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
    

    Check your permissions in your manifest file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey peoples, I've been studying Java for a couple of weeks, and have decided
Hey right now I'm using jQuery and I have some global variables to hold
Hey having some trouble trying to maintain transparency on a png when i create
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd)
Hey so what I want to do is snag the content for the first
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey all, my Computational Science course this semester is entirely in Java. I was
Hey, I've been developing an application in the windows console with Java, and want
Hey, in the Programming Pearls book, there is a source code for setting, clearing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.