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 3943968
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:50:41+00:00 2026-05-20T00:50:41+00:00

Hello i have a problem with this aplication. import java.util.ArrayList; import java.util.List; import android.app.Activity;

  • 0

Hello i have a problem with this aplication.

import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;

import android.telephony.SmsManager;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class Smsfive extends Activity {
/** Called when the activity is first created.
* @param messages */
public void onCreate(Bundle savedInstanceState, ListView messages) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView list = (ListView) findViewById(R.id.list);
List<String> msgList = getSMS();

for(int i = 0; i<msgList.size(); i++) {
System.out.println(msgList.get(i));
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.list_item, R.id.list, msgList);  --> there is error with list_item

//ListView messages;
messages.setAdapter(adapter);
messages.setOnItemClickListener(new OnItemClickListener()
{


@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
SmsManager m = SmsManager.getDefault();
TextView view;
String destinationNumber=(String) ((TextView) view).getText();
m.sendTextMessage(destinationNumber, null, destinationNumber, null, null);

}
});
}

public List<String> getSMS() {
List<String> messages = new ArrayList<String>();
Uri uri = Uri.parse("content://sms/inbox");
Cursor c = null;
try{
c = getApplicationContext().getContentResolver().query (uri, null, null ,null,null);
}catch(Exception e){
e.printStackTrace();
}
try{
for (boolean hasData = c.moveToFirst(); hasData; hasData = c.moveToNext()) {
final String address = c.getString(c.getColumnIndex("address"));
final String body = c.getString(c.getColumnIndexOrThrow("body"));
messages.add("Number: " + address + ". Message: " + body);
}
}catch(Exception e){
e.printStackTrace();
}
c.close();
return messages;
}
}

XML file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/widget30"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
androidrientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</ListView>
</LinearLayout>

Error:

Description Resource Path Location
Type list_item cannot be resolved or
is not a field Smsfive.java
/Sms5/src/sms/five line 30 Java
Problem

What can i do please?

  • 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-20T00:50:41+00:00Added an answer on May 20, 2026 at 12:50 am

    Definitely either you are missing name of the file or even file list_item.xml. So Insure that this layout file must be exist in your res/layout directory.

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

Sidebar

Related Questions

Hello i have problem with my sms aplication. import java.util.ArrayList; import java.util.List; import android.app.Activity;
I have this problem when trying to run hello world program using android SDK.
Hello i have the following problem, I record a video using red5 like this:
Hello again everyone, This time I have a problem with Intent & Extras. here's
hello all this seems to be my problem I have a table in mysql
Problem Hello all! I have this code which takes my jpg image loops through
Hello i have the this problem, i need your help to figure out what
Hello there android experts, I have a problem for some time and after some
Hello guys i have a problem streaming PDF files with php, i'm using this
Hello I started trying to develop Android applications today, but I have a problem:

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.