Advertisement
Guest User

Untitled

a guest
Jan 5th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. public View getView(final int position, View convertView, ViewGroup parent) {
  2.  
  3.     TextView title;
  4.     TextView info;
  5.  
  6.     inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  7.     View itemView = inflater.inflate(R.layout.listCell, parent, false);
  8.     resultp = data.get(position);
  9.     Log.w("position", Integer.toString(position));
  10.  
  11.     itemView.setOnClickListener(new View.OnClickListener() {
  12.         @Override
  13.         public void onClick(View v) {
  14.  
  15.             try {
  16.                 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(resultp.get("url")));
  17.                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  18.                 context.startActivity(intent);
  19.             } catch (ActivityNotFoundException e) {
  20.                 // No browser?
  21.             }
  22.         }
  23.     });
  24.  
  25.     title = (TextView) itemView.findViewById(R.id.title);
  26.     info = (TextView) itemView.findViewById(R.id.info);
  27.  
  28.     title.setText(resultp.get("title"));
  29.     info.setText(resultp.get("info"));
  30.     return itemView;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement