Android Open Source - TATupload Resolve Info Array Adapter






From Project

Back to project page TATupload.

License

The source code is released under:

GNU General Public License

If you think the Android project TATupload listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package uk.org.sucu.tatupload;
// w  w  w .  j  a  va2 s .c  om
import java.util.List;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ResolveInfoArrayAdapter extends ArrayAdapter<ResolveInfo> {

  private PackageManager pm;

  public ResolveInfoArrayAdapter(Context context, int resource, List<ResolveInfo> objects) {
    super(context, resource, objects);
    pm = context.getPackageManager();
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent){
    return makeView(position);
  }
  
  @SuppressLint("InflateParams")
  private View makeView(int position){
    
    ResolveInfo info = getItem(position);

    View view = LayoutInflater.from(getContext()).inflate(R.layout.browser_data_layout, null);
    
    TextView tv = (TextView) view.findViewById(R.id.browserNameLabel);
    tv.setText(info.loadLabel(pm));
    
    ImageView iv = (ImageView) view.findViewById(R.id.iconImageView);
    try {
      Drawable icon = getContext().getPackageManager().getApplicationIcon(info.activityInfo.packageName);
      iv.setImageDrawable(icon);
    } catch (NameNotFoundException e) {
      
    }
    
    return view;
  }
  
  @Override
  public View getDropDownView(int position, View convertView, ViewGroup parent){
    return makeView(position);
  }
}




Java Source Code List

org.apache.pig.impl.util.ObjectSerializer.java
uk.org.sucu.tatupload.BrowserAccessor.java
uk.org.sucu.tatupload.MessageArrayAdapter.java
uk.org.sucu.tatupload.NetCaller.java
uk.org.sucu.tatupload.Notifications.java
uk.org.sucu.tatupload.ParameterArrayAdapter.java
uk.org.sucu.tatupload.ResolveInfoArrayAdapter.java
uk.org.sucu.tatupload.Settings.java
uk.org.sucu.tatupload.TabContent.java
uk.org.sucu.tatupload.TabManager.java
uk.org.sucu.tatupload.TatUploadApplication.java
uk.org.sucu.tatupload.activity.MainActivity.java
uk.org.sucu.tatupload.activity.OptionActivity.java
uk.org.sucu.tatupload.activity.ParameterViewActivity.java
uk.org.sucu.tatupload.activity.SmsReviewActivity.java
uk.org.sucu.tatupload.activity.TutorialActivity.java
uk.org.sucu.tatupload.message.SmsList.java
uk.org.sucu.tatupload.message.SmsReceiver.java
uk.org.sucu.tatupload.message.Text.java
uk.org.sucu.tatupload.parse.Parameters.java
uk.org.sucu.tatupload.parse.Parser.java
uk.org.sucu.tatupload.parse.Property.java