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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:06:29+00:00 2026-06-04T05:06:29+00:00

I have two activitys… Activity 1: have a edittext and two button:button1 & button2

  • 0

I have two activitys…
Activity 1: have a edittext and two button:button1 & button2
Activity 2: have a autocompletetextview and a listview

I want to that when i enter string to edittext and click button1 ,i create a HashMap(static) to save value(set defaul=”hello word”) and key as string in edittext…
Event when click button1:

button.setOnClickListener(new OnClickListener() {       
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
  hashMap.put(edittext.getText().toString(),"hello word");//I declared hashMap  
}
});

In activity2 :

public class Notification_App extends Activity {

    AutoCompleteTextView actv_notification;
    ListView lv_notification;
    Dictionary1 dictionary1;
    ArrayList<String> str_value;
    ArrayList<String> array_key;

@Override
public void onCreate(Bundle circle)
{
    super.onCreate(circle);
    setContentView(R.layout.notification);

    actv_notification=(AutoCompleteTextView)findViewById(R.id.actv_notification);
    lv_notification=(ListView)findViewById(R.id.listview_notification);

    array_key=new ArrayList<String>(dictionary1.hashMap.keySet());
    Iterator myVeryOwnIterator = dictionary1.hashMap.keySet().iterator();
    while(myVeryOwnIterator.hasNext())
    {
        String key=(String)myVeryOwnIterator.next();
        String value=(String)dictionary1.hashMap.get(key);
        str_value.add(value);
    }

    ArrayAdapter<String> adapter=new ArrayAdapter<String>(Notification_App.this, android.R.layout.simple_dropdown_item_1line,array_key);
    ArrayAdapter<String> adapter1=new ArrayAdapter<String>(Notification_App.this, android.R.layout.simple_list_item_1,array_key);


    actv_notification.setAdapter(adapter);
    lv_notification.setAdapter(adapter1);
    lv_notification.setOnItemClickListener(new OnItemClickListener() {

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position,
    long id) {
    // TODO Auto-generated method stub
    Toast.makeText(getBaseContext(), str_value.get(position), Toast.LENGTH_LONG).show();
    }
    });     
}

but error display: null poiter at line: str_value.add(value);…Can you help me..

  • 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-04T05:06:31+00:00Added an answer on June 4, 2026 at 5:06 am

    Try to add

    str_value = new ArrayList<String>();
    

    Before the first

    str_value.add(value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android Activity that needs to catch two different broadcasts. My current
suppose that you have two activities A(which is the main activity) and B when
I have two activity in my app say A & B. Activity A needs
I have two spinners (day_spin and time_spin) in one Activity . I want to
Let say that I have two Activity to develop in Android. Upon the end
I have two separate activities that both can reference a third activity. Basically I
In my activity I have two thumbnail pictures. I want to show the pictures
I have two activity groups that contain a list that go to a detail
In my application i have two activity .When we enter the data in first
I have a three-page/Activity setup/configuration piece to my app. I want to have two

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.