Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I\'m working on building an android app. I\'m following a video. I don\'t kn

ID: 3604007 • Letter: H

Question

Hi, I'm working on building an android app. I'm following a video. I don't know why it's giving me the errors for listViewCountry and array. I do have the corresponding the java libraries. Please explain I'll appreciate it.

package com. faryalfarooq.isearch; import android. support.v7.app.AppCompatActivity; import android.os. Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.Arrays; //import java.util.concurrent.atomic.AtomicReference; public class MainActivity extends AppCompatActivity f ArrayAdaptereString> adapter: @Override protected void onCreate (Bundle savedInstanceState)f super.onCreate(savedInstanceState); setContentView(R. layout.activity_main); //AtomicReference«ListView lv= new AtomicReferenceo((ListView) findViewById(R.id.ListViewCountry)); ListView 1v =(ListView) findViewById(R.id.ListViewCountry); ArrayList arrayCountry = new ArrayList(); arrayCountry.addAll(Arrays.asList(getResources().getStringArray(R.array.array_country))); adapter= new ArrayAdaptercString>(MainActivity. this, android .R·layout. simple-expandable-List-item 1, arrayCountry); Iv.setAdapter(adapter);

Explanation / Answer

ANSWER :

listViewCountry :

Add a listView in your activity_main.xml file and give it id = "@+id/listViewCountry"

for array:

create an array folder in  res folder and put array_country string in it.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote