title: How to open link Url from listview inside fragment?
body: <p>If I have a listview inside a fragment, it has a custom layout, an array adapter, a fragment class and an array class.
  If I want to open a link when clicking a list contained in the listview, how and where do I put the code?</p>
  <p>I have tried the following code that I put in the fragment class, but when I try to click on the available list, my application force closes. Is my code wrong?</p>
  <pre><code>list_fish_easy.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              Intent linkEasy = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(arrayListeasy)));
              startActivity(linkEasy);
  
          }
      });
  </code></pre>
  <p>What I want is that I can open the link contained in the arraylist like the following</p>
  <pre><code>public class Fish extends Fragment {
  @Nullable
  @Override
  public View onCreateView(@NonNull LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable Bundle savedInstanceState) {
      final View view = inflater.inflate(R.layout.fish_layout, container, false);
      ListView list_fish_easy = (ListView) view.findViewById(R.id.list_fish_easy);
     
      final ArrayList&lt;Animal&gt; arrayListeasy= new ArrayList&lt;&gt;();
      arrayListeasy.add(new Animal(&quot;Contoh Nama 1&quot;, &quot;Easy&quot;, &quot;Ominvore&quot;, &quot;7.5&quot;, &quot;30 C&quot;, &quot;http://images.google.com/images?um=1&amp;hl=en&amp;safe=active&amp;nfpr=1&amp;q=cabomba_aquatica&quot;));
      arrayListeasy.add(new Animal(&quot;Contoh Nama 2&quot;, &quot;Moderate&quot;, &quot;Ominvore&quot;, &quot;7.5&quot;, &quot;30 C&quot;, &quot;http://images.google.com/images?um=1&amp;hl=en&amp;safe=active&amp;nfpr=1&amp;q=cabomba_aquatica&quot;));
      arrayListeasy.add(new Animal(&quot;Contoh Nama 3&quot;, &quot;Difficult&quot;, &quot;Ominvore&quot;, &quot;7.5&quot;, &quot;30 C&quot;, &quot;http://images.google.com/images?um=1&amp;hl=en&amp;safe=active&amp;nfpr=1&amp;q=cabomba_aquatica&quot;));
  
            final AnimalAdapter animalAdaptereasy = new AnimalAdapter(getContext(), R.layout.list_fish, arrayListeasy);
     
      list_fish_easy.setAdapter(animalAdaptereasy);
      
      list_fish_easy.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
  
              Intent linkEasy = new Intent(Intent.ACTION_VIEW, Uri.parse(String.valueOf(arrayListeasy)));
  
              if(linkEasy.resolveActivity(requireContext().getPackageManager()) != null) {
                  startActivity(linkEasy);
              }
  
          }
      });
  
      return view;
  }
  </code></pre>
  <p>}</p>
  <p>I am very new to creating Android programs. Please help</p>