小编ma3*_*a34的帖子

单击后退按钮android时最小化应用程序

我创建了一个应用程序,在onPause()按下后退按钮时调用它.

如下方式..

protected void onPause() {
        // TODO Auto-generated method stub
        super.onPause();

        // Notification show in status bar

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
                this).setSmallIcon(R.drawable.icon).setContentTitle("TNLRadio")
                .setContentText("");
        // Creates an explicit intent for an Activity in your app
        // Intent resultIntent = new Intent(this, MainActivity.class);
        Intent resultIntent = this.getIntent();

        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
        // Adds the back stack for the Intent (but not the Intent itself)
        stackBuilder.addParentStack(MainActivity.class);
        // Adds the Intent that starts the Activity to the top of the …
Run Code Online (Sandbox Code Playgroud)

performance android

5
推荐指数
1
解决办法
2958
查看次数

在ListView上单击删除按钮后删除ListView上的项目

我编写了一个代码,用于在ListView中动态显示图像,按钮和文本.所以ListView加载按钮.我想通过单击此按钮删除ListView中的所选项目.

适配器类:

public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private String[] data;
    private static LayoutInflater inflater=null;
    public ImageLoaderLogoUnder imageLoader; 

    public LazyAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoaderLogoUnder(activity.getApplicationContext());
    }

    public int getCount() {
        return data.length;
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.inflatelistview, null);

        TextView text=(TextView)vi.findViewById(R.id.textView1);
        ImageView image=(ImageView)vi.findViewById(R.id.imageView1); …
Run Code Online (Sandbox Code Playgroud)

android android-listview android-adapter

2
推荐指数
1
解决办法
1万
查看次数