Android Open Source - dialogplus Main Activity






From Project

Back to project page dialogplus.

License

The source code is released under:

Apache License

If you think the Android project dialogplus 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 com.orhanobut.android.dialogplussample;
/*from  ww w .  j  a va2s.c  o m*/
import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.ArrayAdapter;

import com.orhanobut.dialogplus.DialogPlus;
import com.orhanobut.dialogplus.ListHolder;
import com.orhanobut.dialogplus.OnItemClickListener;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ArrayAdapter<String> adapter = new ArrayAdapter<>(
                this, R.layout.simple_list_item_1, new String[]{"Item 1", "Item 2", "Item 3", "Item 4"}
        );
        final DialogPlus dialog = new DialogPlus.Builder(this)
                .setHolder(new ListHolder())    // Optional, default:BasicHolder
                .setHeader(R.layout.header)     // Optional
                .setFooter(R.layout.footer)     // Optional
                .setCancelable(true)            // Optional default:true
                .setGravity(Gravity.BOTTOM)     // Optional default:true
                .setAdapter(adapter)            // This must be added
                .setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(Object item, View view, int position) {

                    }
                })
                .create();
        dialog.show();
        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.show();
            }
        });
    }
}




Java Source Code List

com.orhanobut.android.dialogplus.ApplicationTest.java
com.orhanobut.android.dialogplussample.ApplicationTest.java
com.orhanobut.android.dialogplussample.MainActivity.java
com.orhanobut.dialogplus.BasicHolder.java
com.orhanobut.dialogplus.DialogPlus.java
com.orhanobut.dialogplus.GridHolder.java
com.orhanobut.dialogplus.Holder.java
com.orhanobut.dialogplus.ListHolder.java
com.orhanobut.dialogplus.OnItemClickListener.java
com.orhanobut.dialogplus.SimpleListView.java