Click here to Skip to main content
15,892,059 members
Home / Discussions / Android
   

Android

 
AnswerRe: android Pin
Dadecki17-Jun-15 22:54
Dadecki17-Jun-15 22:54 
Questionhow to point in google map using address..? Pin
Member 1172141526-May-15 18:57
Member 1172141526-May-15 18:57 
QuestionRe: how to point in google map using address..? Pin
Richard MacCutchan26-May-15 22:00
mveRichard MacCutchan26-May-15 22:00 
AnswerRe: how to point in google map using address..? Pin
David Crow27-May-15 2:55
David Crow27-May-15 2:55 
QuestionProblem with java and Android Pin
Member 1172109726-May-15 14:59
Member 1172109726-May-15 14:59 
SuggestionRe: Problem with java and Android Pin
Richard MacCutchan26-May-15 21:58
mveRichard MacCutchan26-May-15 21:58 
GeneralRe: Problem with java and Android Pin
Member 1172109727-May-15 15:56
Member 1172109727-May-15 15:56 
GeneralRe: Problem with java and Android Pin
David Crow28-May-15 4:20
David Crow28-May-15 4:20 
I put your Android code into an activity, like:
public class MainActivity extends Activity 
{
    EditText inputText = null;
    ArrayList<String> ll = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ll = new ArrayList<String>();

        inputText = (EditText) findViewById(R.id.inputText);

        Button add = (Button) findViewById(R.id.add);
        add.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v) 
            {
                String item = inputText.getText().toString();
                ll.add(item);			

                inputText.setText("");
            }			
        });

        Button results = (Button) findViewById(R.id.results);
        results.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v) 
            {
                android.util.Log.d("Test", "List has " + ll.size() + " items.");																								

                HashSet<String> set = new HashSet<String>(ll);
                for (String temp : set)
                    android.util.Log.d("Test", temp + " was found " + Collections.frequency(ll, temp) + " times.");
            }			
        });
    }
}


Entering the numbers:

33
44
33
44
24
24

produced the following output:

List has 6 items.
44 was found 2 times.
24 was found 2 times.
33 was found 2 times.

So, I'm not sure what else you have in your Android code that is causing it not to work.

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles


QuestionHow can I export my Database Information in a file Pin
Jamil.Chowdhury24-May-15 6:46
Jamil.Chowdhury24-May-15 6:46 
QuestionRe: How can I export my Database Information in a file Pin
David Crow26-May-15 7:25
David Crow26-May-15 7:25 
QuestionWhat's the real meaning of a widget? Pin
CRobert45623-May-15 9:46
CRobert45623-May-15 9:46 
AnswerRe: What's the real meaning of a widget? Pin
David Crow23-May-15 12:33
David Crow23-May-15 12:33 
AnswerRe: What's the real meaning of a widget? Pin
Dadecki17-Jun-15 22:56
Dadecki17-Jun-15 22:56 
QuestionUsing a certificate in an android app Pin
Member 1168395012-May-15 8:48
Member 1168395012-May-15 8:48 
QuestionRe: Using a certificate in an android app Pin
David Crow19-May-15 2:32
David Crow19-May-15 2:32 
AnswerRe: Using a certificate in an android app Pin
Member 1168395019-May-15 5:55
Member 1168395019-May-15 5:55 
AnswerRe: Using a certificate in an android app Pin
Member 116839506-Jun-15 7:02
Member 116839506-Jun-15 7:02 
QuestionRegarding Android.. Pin
Member 116768678-May-15 23:21
Member 116768678-May-15 23:21 
SuggestionRe: Regarding Android.. Pin
Richard MacCutchan9-May-15 0:23
mveRichard MacCutchan9-May-15 0:23 
AnswerRe: Regarding Android.. Pin
Dadecki13-May-15 2:57
Dadecki13-May-15 2:57 
Questionhow do we provide security for web app connecting to server Pin
Member 116738607-May-15 19:39
Member 116738607-May-15 19:39 
AnswerRe: how do we provide security for web app connecting to server Pin
Richard MacCutchan7-May-15 21:25
mveRichard MacCutchan7-May-15 21:25 
QuestionRaw cannot be resolved in Eclipse Juno Pin
Member 116612166-May-15 13:09
Member 116612166-May-15 13:09 
AnswerRe: Raw cannot be resolved in Eclipse Juno Pin
Richard MacCutchan6-May-15 21:17
mveRichard MacCutchan6-May-15 21:17 
GeneralRe: Raw cannot be resolved in Eclipse Juno Pin
Member 116612166-May-15 23:16
Member 116612166-May-15 23:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.