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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:54:37+00:00 2026-06-05T09:54:37+00:00

For my class we have to create an application where we catch an SMS

  • 0

For my class we have to create an application where we catch an SMS message in a broadcast receiver, get the string (assumed to be a URL), add it dynamically to a string-array which is displayed in a fragmentlist. When the list item is clicked we then have to load it into a webview in a fragment.

Everything works until here.

The problem is that the list doesn’t update when I try to add the url_act string to it.

Here’s my code:

public class UpdateString extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    String url_act = "";
    Bundle b = getIntent().getExtras();
    url_act = b.getString("url");

    UrlListFragment uf = (UrlListFragment) getFragmentManager()
            .findFragmentById(R.id.listFragment);


    String[] urls = getResources().getStringArray(R.array.urls_array);
    List<String> list = new ArrayList<String>();
    list = Arrays.asList(urls);
    ArrayList<String> arrayList = new ArrayList<String>(list);
    arrayList.add(url_act);
    urls = arrayList.toArray(new String[list.size()]);

    ArrayAdapter<String> adapter = new ArrayAdapter<String>(UpdateString.this,
            android.R.layout.simple_list_item_1, urls);
    uf.setListAdapter(adapter);



}

If you need more code for context let me know. Updated

  • 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-05T09:54:38+00:00Added an answer on June 5, 2026 at 9:54 am

    You really should post your logcat output just to be sure, as otherwise we don’t know what kind of exception was thrown.

    That being said, I bet it is a NullPointerException; findFragmentById() is most likely returning null. This is probably because you never inflate your XML resource to begin with.

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

Sidebar

Related Questions

I am using the webapplicationbuilder class to create a new web application and have
I have created a class that extends Application to store variables I want to
I have create my own NSOpenGLView class, right now the data that i want
I have class to create user and return the info of user (success). class
I have to create an serializable class which has and xml in the format
I have this class that have a function to load other classes and create
So for my programming class we have had a project to create a virtual
I have a class which would create a bean and the bean has few
I intended to create a class which only have static members and static functions.
Suppose we have a class. We create an object from the class and when

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.