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

  • SEARCH
  • Home
  • 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 8778683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:35:28+00:00 2026-06-13T19:35:28+00:00

My application code is as follows, public class Alarm extends MainActivity { public String

  • 0

My application code is as follows,

public class Alarm extends MainActivity {

public String str;

public void onReceive(Context context, Intent intent) {
    //---get the CB message passed in---
    Bundle bundle = intent.getExtras();        
    SmsCbMessage[] msgs = null;
    str = "";            
    if (bundle != null)  {
        //---retrieve the SMS message received---
        Object[] pdus = (Object[]) bundle.get("pdus");
        msgs = new SmsCbMessage[pdus.length];            
        for (int i=0; i<msgs.length; i++) {
            msgs[i] = SmsCbMessage.createFromPdu((byte[])pdus[i]);                
            str += "CB " + msgs[i].getGeographicalScope() + msgs[i].getMessageCode() + msgs[i].getMessageIdentifier() + msgs[i].getUpdateNumber();                     
            str += " :";
            str += "\n";        
        }
        }
        }


EditText user_value;
Button startalarm;


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

startalarm = (Button) findViewById(R.id.startalarm);
user_value = (EditText) findViewById(R.id.user_value);

startalarm.setOnClickListener(new View.OnClickListener() 
{

public void onClick(View arg0)
{
        // TODO Auto-generated method stub
if(user_value.length()==0)
{
    Toast.makeText(getBaseContext(), "Please enter a value.", Toast.LENGTH_LONG).show();
}

    SQLiteDatabase aa = openOrCreateDatabase("MLIdata", MODE_WORLD_READABLE, null);
    Cursor c = aa.rawQuery("SELECT CblocationName FROM MLITable WHERE CblocationCode = '"+str+"'", null);
    c.moveToFirst();
    c.getString(c.getColumnIndex("CblocationName"));
    String sas = user_value.getText().toString();
    if(sas==getString(c.getColumnIndex("CblocationName")))
    {
        //here comes the alarm code

        Toast.makeText(getBaseContext(), "till here it has executed.",     Toast.LENGTH_LONG).show();
        Notification notification = new     Notification(android.R.drawable.ic_popup_reminder,
        "My Notification", System.currentTimeMillis());
        notification.defaults |= Notification.DEFAULT_SOUND;
        notification.defaults |= Notification.DEFAULT_VIBRATE;
    }
}


});
}
   }

Though there are no errors, when I run this code it force closes when I press the ‘startalarm’ button.

My log cat is as follows,

11-05 01:31:03.029: W/ResourceType(1554): No package identifier when getting value for resource number 0x00000000
11-05 01:31:03.029: W/dalvikvm(1554): threadid=1: thread exiting with uncaught exception (group=0x40018578)
11-05 01:31:03.029: E/AndroidRuntime(1554): FATAL EXCEPTION: main
11-05 01:31:03.029: E/AndroidRuntime(1554): android.content.res.Resources$NotFoundException:     String resource ID #0x0
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.content.res.Resources.getText(Resources.java:201)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.content.res.Resources.getString(Resources.java:254)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.content.Context.getString(Context.java:183)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at my.project.mil.Alarm$1.onClick(Alarm.java:68)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.view.View.performClick(View.java:2485) 
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.view.View$PerformClick.run(View.java:9080)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.os.Handler.handleCallback(Handler.java:587)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.os.Handler.dispatchMessage(Handler.java:92)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.os.Looper.loop(Looper.java:130)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at android.app.ActivityThread.main(ActivityThread.java:3687)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at java.lang.reflect.Method.invokeNative(Native Method)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at java.lang.reflect.Method.invoke(Method.java:507)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
11-05 01:31:03.029: E/AndroidRuntime(1554):     at dalvik.system.NativeStart.main(Native Method)

I’ve tried all the solutions given in the below link, yet none helped.

Android, string resource not found

Help required,

Thank you.

  • 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-06-13T19:35:29+00:00Added an answer on June 13, 2026 at 7:35 pm

    I had no idea my comment would fix your exception. I will put it as an answer so you can close this question.

    Change this line:

    if(sas==getString(c.getColumnIndex("CblocationName")))
    

    to

    if(sas.equals(getString(c.getColumnIndex("CblocationName"))))
    

    Read up on String comparison if you don’t understand why this should be like this.

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

Sidebar

Related Questions

Given the following classes: public class Lookup { public string Code { get; set;
my database table TAGS(TagId,TagName) my web method code is as follows public List<Tag> FetchTagList(string
I have created an Asynchronous WebClient request inside a class as follows: public class
I am using Selenium with Java, TestNG. My java code is as follows: public
I know that the standard singleton pattern is as follows: Original public class Singleton1
I have my application code base with multiple activities in it. I have a
In my application code i am generating GUID using System.Guid.NewGuid() and saving this to
I have this relatively large numerical application code that may run for a few
Out of habit I've been using try/catch blocks in my application code for all
Hi am modelling an Entity with a column named Gender. In the application code,

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.