Java Code Examples for android.widget.ListView#addFooterView()

The following examples show how to use android.widget.ListView#addFooterView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadFragment.java    From 4pdaClient-plus with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    removeArrow();
    view = inflater.inflate(R.layout.downloads_list_activity, container, false);

    m_ListView = (ListView) findViewById(R.id.lstTree);
    m_ListView.addFooterView(createListFooter(inflater));

    m_Adapter = new DownloadTasksAdapter(getContext(), R.layout.download_task_item, getDownloadTasks());

    getListView().setAdapter(m_Adapter);
    getListView().setOnItemClickListener(this);
    Client.getInstance().getDownloadTasks().setOnStateListener((context, downloadTask, ex) -> mHandler.post(() -> m_Adapter.notifyDataSetChanged()));
    return view;
}
 
Example 2
Source File: SampleActivity.java    From PullToRefresh-PinnedSection-ListView with MIT License 6 votes vote down vote up
private void initializeHeaderAndFooter() {
    setListAdapter(null);
    if (hasHeaderAndFooter) {
    	
    	mpPullToRefreshPinnedSectionListView  = (PullToRefreshPinnedSectionListView) findViewById(R.id.list);
    	
        ListView list = getListView();

        LayoutInflater inflater = LayoutInflater.from(this);
        TextView header1 = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false);
        header1.setText("First header");
        list.addHeaderView(header1);

        TextView header2 = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false);
        header2.setText("Second header");
        list.addHeaderView(header2);

        TextView footer = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, list, false);
        footer.setText("Single footer");
        list.addFooterView(footer);
    }
    initializeAdapter();
}
 
Example 3
Source File: AppListFragment.java    From EventApp with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    int padding = (int) (getResources().getDisplayMetrics().density * 8); // 8dip
    ListView listView = getListView();
    listView.setPadding(padding, 0, padding, 0);
    listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
    listView.setDivider(null);

    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View header = inflater.inflate(R.layout.list_header_footer, listView, false);
    View footer = inflater.inflate(R.layout.list_footer, listView, false);

    TextView tv = (TextView) footer.findViewById(R.id.footer);
    String str = getResources().getString(R.string.footer);
    MovementMethod method = LinkMovementMethod.getInstance();
    tv.setMovementMethod(method);
    CharSequence html = Html.fromHtml(str);
    tv.setText(html);

    listView.addHeaderView(header, null, false);
    listView.addFooterView(footer, null, false);

    setTrack(7);
}
 
Example 4
Source File: RecentActivityActivity.java    From Inside_Android_Testing with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.recent_activity_layout);

    authenticationGateway = new AuthenticationGateway(apiGateway, this);
    recentActivities = new RecentActivities(apiGateway, authenticationGateway);

    ListView recentActivityListView = (ListView) findViewById(R.id.recent_activity_list);

    View loadingView = getLayoutInflater().inflate(R.layout.loading_view, recentActivityListView, false);
    recentActivityListView.addFooterView(loadingView, null, false);
    recentActivityListView.setFooterDividersEnabled(false);

    RecentActivityAdapter recentActivityAdapter = new RecentActivityAdapter(recentActivities, getLayoutInflater());
    recentActivityListView.setAdapter(recentActivityAdapter);

    showLoadingWhileOutstanding = new ViewVisibleWhileOutstandingCallbacks(loadingView);
    notifyDataSetChangedCallbacks = new NotifyDataSetChangedCallbacks(recentActivityAdapter);

    updateOrSignIn();
}
 
Example 5
Source File: NetSearchFragment.java    From LitePlayer with Apache License 2.0 6 votes vote down vote up
private void setupViews(View layout) {
	mSearchShowLinearLayout = (LinearLayout) layout.findViewById(R.id.ll_search_btn_container);
	mSearchLinearLayout = (LinearLayout) layout.findViewById(R.id.ll_search_container);
	mSearchButton = (ImageButton) layout.findViewById(R.id.ib_search_btn);
	mSearchEditText = (EditText) layout.findViewById(R.id.et_search_content);
	mSearchResultListView = (ListView) layout.findViewById(R.id.lv_search_result);
	mSearchProgressBar = (ProgressBar) layout.findViewById(R.id.pb_search_wait);
	mFooterView = buildFooterView();
	
	mSearchShowLinearLayout.setOnClickListener(this);
	mSearchButton.setOnClickListener(this);
	
	mSearchResultListView.addFooterView(mFooterView);
	
	mSearchResultAdapter = new SearchResultAdapter(mResultData);
	mSearchResultListView.setAdapter(mSearchResultAdapter);
	mSearchResultListView.setOnScrollListener(mListViewScrollListener);
	mSearchResultListView.setOnItemClickListener(mResultItemClickListener);
}
 
Example 6
Source File: ListViewActivity.java    From ZzLettersSideBar with Apache License 2.0 6 votes vote down vote up
public void initView() {

        sideBar = (ZzLetterSideBar) findViewById(R.id.sidebar);
        dialog = (TextView) findViewById(R.id.tv_dialog);
        listView = (ListView) findViewById(R.id.list_view);

        //optional
        View header = LayoutInflater.from(this).inflate(R.layout.list_item_head, null);
        listView.addHeaderView(header);

        //optional
        View footer = LayoutInflater.from(this).inflate(R.layout.list_item_foot, null);
        tvFoot = (TextView) footer.findViewById(R.id.tv_foot);
        listView.addFooterView(footer);

        mDatas = new ArrayList<>();
        adapter = new PersonListViewAdapter(this, mDatas);
        listView.setAdapter(adapter);
    }
 
Example 7
Source File: ImsakiyeFragment.java    From prayer-times-android with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle bdl) {
    ListView lv = new ListView(getActivity());
    mAdapter = new ImsakiyeAdapter(getActivity());
    lv.setAdapter(mAdapter);
    setTimes(mTimes);
    TextView addMore = new TextView(getActivity());
    addMore.setText("\n" + getString(R.string.showMore) + "\n");
    addMore.setGravity(Gravity.CENTER);
    addMore.setOnClickListener(view -> {
        mAdapter.daysInMonth += 7;
        mAdapter.notifyDataSetInvalidated();
    });
    lv.addFooterView(addMore);
    lv.setBackgroundResource(R.color.background);
    return lv;
}
 
Example 8
Source File: RefreshLayout.java    From SwipeRefreshLayout with Apache License 2.0 5 votes vote down vote up
public void setFooterView(Context context, ListView mListView, int layoutId) {
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mListViewFooter = LayoutInflater.from(context).inflate(layoutId, null,
            false);
    mListView.addFooterView(mListViewFooter);
    mListView.setFooterDividersEnabled(false);
    this.mListView = mListView;
}
 
Example 9
Source File: ShowDevices.java    From coursera-android with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
	final ListView lv = getListView();
	final TextView footer = new TextView(this);
	footer.setText("Discover More Devices");
	lv.setFooterDividersEnabled(true);
	lv.addFooterView(footer, null, true);

	final List<String> devices = getIntent().getStringArrayListExtra("devices");
	mArrayAdapter = new ArrayAdapter<String>(this, R.layout.list_item,devices);
	setListAdapter(mArrayAdapter);
	getListView().setOnItemClickListener(new OnItemClickListener() {
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int pos,long id) {
			if (parent.getAdapter().getItemViewType(pos) == AdapterView.ITEM_VIEW_TYPE_HEADER_OR_FOOTER) {
				mBluetoothAdapter.startDiscovery();
			} else {
				String tmp = (String) parent.getItemAtPosition(pos);
				BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(tmp.split("\n")[1]);
				Intent data = new Intent();
				data.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
				setResult(RESULT_OK, data);
				finish();
			}
		}
	});
}
 
Example 10
Source File: AttendanceActivity.java    From bunk with MIT License 5 votes vote down vote up
private void setupListView() {
    ListView subjectsList = findViewById(R.id.subjects);
    LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    subjectsList.addFooterView(layoutInflater.inflate(R.layout.listview_footer, null, false));
    this.subjectViews = new ArrayList<>();
    this.subjectAdapter = new SubjectAdapter(this.subjectViews);
    subjectsList.setAdapter(this.subjectAdapter);
}
 
Example 11
Source File: titleFragment.java    From xmpp with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (view == null) {
        view = inflater.inflate(R.layout.fragment_title, container, false);
        mlistview = (ListView) view.findViewById(R.id.fragment_content_listview);
        mRefreshLayout = (RefreshLayout) view.findViewById(R.id.fragment_content_swipe_container);
        footerLayout = getActivity().getLayoutInflater().inflate(R.layout.list_item_more, null);
        tv_more = (TextView) footerLayout.findViewById(R.id.text_more);
        pb = (ProgressBar) footerLayout.findViewById(R.id.load_progress_bar);
        tv_more.setOnClickListener(this);
        mlistview.addFooterView(footerLayout);
        mRefreshLayout.setOnRefreshListener(this);
        mRefreshLayout.setOnLoadListener(this);
        mlistview.setOnItemClickListener(this);
        mRefreshLayout.setChildView(mlistview);
        mRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_dark,
                android.R.color.holo_red_light,
                android.R.color.black);
        list = new ArrayList<>();
        Bundle bd = getArguments();
        if (bd != null) {
            news = (News_type) bd.getSerializable(CommonConstant.TABPAGE_ENTITY);
            getData(news);

        }


    }

    return view;
}
 
Example 12
Source File: pinglunFragment.java    From xmpp with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (view == null) {
        list = new ArrayList<>();
        view = inflater.inflate(R.layout.fragment_pinglun, container, false);
        footerLayout = getActivity().getLayoutInflater().inflate(R.layout.list_item_more, null);
        tv_more = (TextView) footerLayout.findViewById(R.id.text_more);
        tv_more.setOnClickListener(this);
        pb = (ProgressBar) footerLayout.findViewById(R.id.load_progress_bar);
        intent = getActivity().getIntent();
        content = (News_content) intent.getSerializableExtra("news_content");
        tv_title = (TextView) view.findViewById(R.id.news_content_textView_title);
        tv_author = (TextView) view.findViewById(R.id.news_content_textView_author);
        tv_time = (TextView) view.findViewById(R.id.news_content_textView_time);
        tv_total = (TextView) view.findViewById(R.id.news_content_textView_total);
        listview = (ListView) view.findViewById(R.id.news_content_listView);
        listview.addFooterView(footerLayout);
        mRefreshLayout = (RefreshLayout) view.findViewById(R.id.fragment_content_swipe_container);
        mRefreshLayout.setOnRefreshListener(this);
        mRefreshLayout.setOnLoadListener(this);
        mRefreshLayout.setChildView(listview);
        mRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
                android.R.color.holo_green_dark,
                android.R.color.holo_red_light,
                android.R.color.black);
        tv_title.setText(content.getCtitle());
        tv_author.setText(content.getCauthor());
        tv_time.setText(content.getCtime());
        user = ((NewsContentActivity) getActivity()).user;
        getData(content.getCid(), 0);

    }


    return view;
}
 
Example 13
Source File: MainActivity.java    From multi-column-list-adapter with Apache License 2.0 5 votes vote down vote up
private void setupGrid() {
    SQLiteDatabase db = ActiveAndroid.getDatabase();
    Cursor cursor = db.query(ToasterModel.TABLE_NAME, null, null, null, null, null, null);

    ToasterAdapter adapter = new ToasterAdapter(this, cursor,
            R.layout.grid_item, R.integer.num_columns, R.dimen.grid_spacing, R.dimen.grid_spacing);

    View headerView = LayoutInflater.from(this).inflate(R.layout.view_header, null, false);
    View footerView = LayoutInflater.from(this).inflate(R.layout.view_footer, null, false);

    multiColumnList = (ListView) findViewById(R.id.multiColumnList);
    multiColumnList.addHeaderView(headerView);
    multiColumnList.addFooterView(footerView);
    multiColumnList.setAdapter(adapter);
}
 
Example 14
Source File: ListViewLoadMoreFooter.java    From 4pdaClient-plus with Apache License 2.0 4 votes vote down vote up
public ListViewLoadMoreFooter(Context context, ListView listView) {
    mContext = context;
    createView();
    listView.addFooterView(mFooterView);
}
 
Example 15
Source File: NewsActivity.java    From QuickNews with MIT License 4 votes vote down vote up
public JsonObjectRequest getCommentsData(String baseUrl, String parameter1, String parameter2 ,
                                         final ListView listView){
    String url=baseUrl+"comments/?count=10&page="+parameter1+"&offset="+parameter2
            +"&item_id=0&format=json";
    System.out.println("访问的Url为"+url);

    JsonObjectRequest jsonObjectRequest=new JsonObjectRequest(url.trim(), null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    try{
                        System.out.println("Volley得到的response是+"+response.toString());
                        Gson gson = new Gson();

                        CommentsData commentsData= gson.fromJson(response.toString(),new TypeToken<CommentsData>(){}.getType());
                        List<Comment> commentList=new ArrayList<>();
                        if (commentsData.getMessage().equals("success")){
                            commentList=commentsData.getData().getComments();
                            System.out.println("当前获取的commentList是"+commentList.size());
                            if (commentList.size()>0) {
                                mCommentList.addAll(commentList);
                            }else {
                                mIsLastRow=false;
                                mTextViewMore.setText("已没有更多评论");
                            }
                        }else {
                            mIsLastRow=false;
                            mTextViewMore.setText("已没有更多评论");

                        }

                        CommentsAdapter adapter=new CommentsAdapter(NewsActivity.this,
                                mCommentList,mRequestQueue);
                        if (mCommentList.size()>10){
                            listView.removeFooterView(mLlFooterView);
                        }
                        listView.addFooterView(mLlFooterView);

                        listView.setAdapter(adapter);
                        adapter.notifyDataSetChanged();


                    }catch (Exception e){
                        e.printStackTrace();
                    }

                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            System.out.println("获取信息失败……");
            System.out.println("error是"+error.toString());
            mIsLastRow=false;
            mTextViewMore.setText("已没有更多评论");
            listView.addFooterView(mLlFooterView);
        }
    });

    System.out.println("jsonObjectRequest"+jsonObjectRequest.toString());
    return jsonObjectRequest;
}
 
Example 16
Source File: AbsListViewExampleActivity.java    From Paginate with Apache License 2.0 4 votes vote down vote up
@Override
protected void setupPagination() {
    if (paginate != null) {
        paginate.unbind();
    }
    handler.removeCallbacks(fakeCallback);
    adapter = new PersonAdapter(this, DataProvider.getRandomData(20));
    loading = false;
    page = 0;

    int layoutId;
    switch (absListViewType) {
        case LIST_VIEW:
            layoutId = R.layout.listview_layout;
            break;
        case GRID_VIEW:
            layoutId = R.layout.gridview_layout;
            break;
        default:
            layoutId = R.layout.listview_layout;
            break;
    }

    getContainer().removeAllViews();
    LayoutInflater.from(this).inflate(layoutId, getContainer(), true);

    AbsListView absListView = (AbsListView) findViewById(R.id.abs_list_view);
    if ((absListView instanceof ListView) && useHeaderAndFooter) {
        ListView listView = (ListView) absListView;
        listView.addHeaderView(LayoutInflater.from(this).inflate(R.layout.list_view_header, absListView, false));
        listView.addFooterView(LayoutInflater.from(this).inflate(R.layout.list_view_footer, absListView, false));
    }

    absListView.setAdapter(adapter);
    absListView.setOnItemClickListener(this);
    absListView.setOnItemLongClickListener(this);

    paginate = Paginate.with(absListView, this)
            .setOnScrollListener(this)
            .setLoadingTriggerThreshold(threshold)
            .addLoadingListItem(addLoadingRow)
            .setLoadingListItemCreator(customLoadingListItem ? new CustomLoadingListItemCreator() : null)
            .build();
}
 
Example 17
Source File: NormalRefreshActivity.java    From PullRefreshView with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_normal_refresh);

    listView = (ListView) findViewById(R.id.list);
    headerView = (BaseHeaderView) findViewById(R.id.header);

    list = getData(15);

    adapter = new ArrayAdapter(this, R.layout.item, list);

    footerView = new EndFooterView(this);

    listView.setAdapter(adapter);
    listView.addFooterView(footerView);

    ((PullRefreshLayout) findViewById(R.id.root)).setFooter(footerView);

    headerView.setOnRefreshListener(this);
    footerView.setOnLoadListener(this);
}
 
Example 18
Source File: DataList.java    From trekarta with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Bundle arguments = getArguments();
    double latitude = arguments.getDouble(ARG_LATITUDE);
    double longitude = arguments.getDouble(ARG_LONGITUDE);
    boolean currentLocation = arguments.getBoolean(ARG_CURRENT_LOCATION);
    boolean noExtraSources = arguments.getBoolean(ARG_NO_EXTRA_SOURCES);
    int minHeight = arguments.getInt(ARG_HEIGHT, 0);

    if (savedInstanceState != null) {
        latitude = savedInstanceState.getDouble(ARG_LATITUDE);
        longitude = savedInstanceState.getDouble(ARG_LONGITUDE);
    }

    mCoordinates = new GeoPoint(latitude, longitude);

    if (currentLocation)
        mDataSource.setReferenceLocation(mCoordinates);
    else
        mDataSource.setReferenceLocation(null);

    TextView emptyView = (TextView) getListView().getEmptyView();
    if (emptyView != null) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(getString(R.string.msgEmptyPlaceList));
        if (noExtraSources) {
            stringBuilder.append(mLineSeparator);
            stringBuilder.append(mLineSeparator);
            stringBuilder.append(getString(R.string.msgNoFileDataSources));
        }
        emptyView.setText(stringBuilder.toString());
    }

    mAdapter = new DataListAdapter(getActivity(), mDataSource.getCursor(), 0);
    setListAdapter(mAdapter);

    ListView listView = getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
    listView.setMultiChoiceModeListener(mMultiChoiceModeListener);

    View rootView = getView();
    if (rootView != null && minHeight > 0)
        rootView.setMinimumHeight(minHeight);

    // If list contains no data footer is not displayed, so we should not worry about
    // message being shown twice
    if (noExtraSources) {
        LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if (inflater != null)
            listView.addFooterView(inflater.inflate(R.layout.list_footer_data_source, listView, false), null, false);
    }

    if (mDataSource instanceof WaypointDbDataSource) {
        mFloatingButton = mFragmentHolder.enableListActionButton();
        mFloatingButton.setImageDrawable(getContext().getDrawable(R.drawable.ic_add_location));
        mFloatingButton.setOnClickListener(v -> {
            CoordinatesInputDialog.Builder builder = new CoordinatesInputDialog.Builder();
            CoordinatesInputDialog coordinatesInput = builder.setCallbacks(DataList.this)
                    .setTitle(getString(R.string.titleCoordinatesInput))
                    .create();
            coordinatesInput.show(getFragmentManager(), "pointCoordinatesInput");
        });
    }
}
 
Example 19
Source File: AccountSelectorWindow.java    From YiBo with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
	LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View contentView = inflater.inflate(R.layout.widget_pop_account_selector, null);
    lvAccountSelector = (ListView)contentView.findViewById(R.id.lvAccountSelector);
    ImageView ivAccountSelectorFooter = (ImageView)contentView.findViewById(R.id.ivAccountSelectorFooter);
    Theme theme = ThemeUtil.createTheme(context);
    ThemeUtil.setContentBackground(lvAccountSelector);
    ThemeUtil.setListViewStyle(lvAccountSelector);
    ivAccountSelectorFooter.setBackgroundDrawable(theme.getDrawable("selector_bg_footer_account_selector"));
    
    View footerView = null;
    if (mode == SelectMode.Single) {
    	footerView = inflater.inflate(R.layout.list_item_account_manage, null);
    	LinearLayout llAccountManage = (LinearLayout)footerView.findViewById(R.id.llAccountManage);
    	ImageView ivProfileImage = (ImageView)footerView.findViewById(R.id.ivProfileImage);
    	TextView tvProfileName = (TextView)footerView.findViewById(R.id.tvProfileName);
    	TextView tvImpress = (TextView)footerView.findViewById(R.id.tvImpress);
    	ImageView ivMoreDetail = (ImageView)footerView.findViewById(R.id.ivMoreDetail);
    	llAccountManage.setBackgroundDrawable(theme.getDrawable("selector_frame_item_no_corner"));
    	llAccountManage.setPadding(theme.dip2px(8), theme.dip2px(4), 
    		theme.dip2px(16), theme.dip2px(4));
    	ivProfileImage.setImageDrawable(theme.getDrawable("icon_group"));
    	tvProfileName.setTextColor(theme.getColor("content"));
    	tvImpress.setTextColor(theme.getColor("remark"));
    	ivMoreDetail.setBackgroundDrawable(theme.getDrawable("icon_more_detail"));
    	
    	footerView.setOnClickListener(new AccountManageClickListener(this));
    } else {
    	footerView = inflater.inflate(R.layout.list_item_account_selector_operate, null);
    	Button btnSelectAll = (Button)footerView.findViewById(R.id.btnSelectAll);
    	Button btnSelectInverse = (Button)footerView.findViewById(R.id.btnSelectInverse);
    	ThemeUtil.setBtnActionPositive(btnSelectAll);
    	ThemeUtil.setBtnActionNegative(btnSelectInverse);
    	
    	AccountSelectorOperateClickListener operateClickListener =
    		new AccountSelectorOperateClickListener(this);
    	btnSelectAll.setOnClickListener(operateClickListener);
    	btnSelectInverse.setOnClickListener(operateClickListener);
    }
    lvAccountSelector.addFooterView(footerView);

    listAdapter = new AccountSelectorListAdapter(context, mode, isShowSnsAccount);
    lvAccountSelector.setAdapter(listAdapter);

    popList = new PopupWindow(contentView, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    popList.setBackgroundDrawable(new BitmapDrawable());
    popList.setFocusable(true);
    popList.setOutsideTouchable(true);
}
 
Example 20
Source File: PlaceViewActivity.java    From coursera-android-labs with MIT License 2 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	// Set up the app's user interface. This class is a ListActivity,
       // so it has its own ListView. ListView's adapter should be a PlaceViewAdapter

	mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
	ListView placesListView = getListView();

	// TODO - add a footerView to the ListView
	// You can use footer_view.xml to define the footer

       View footerView = null;

	// TODO - footerView must respond to user clicks, handling 3 cases:

	// There is no current location - response is up to you. The best
	// solution is to always disable the footerView until you have a
	// location.

	// There is a current location, but the user has already acquired a
	// PlaceBadge for this location - issue a Toast message with the text -
	// "You already have this location badge." 
	// Use the PlaceRecord class' intersects() method to determine whether 
	// a PlaceBadge already exists for a given location

	// There is a current location for which the user does not already have
	// a PlaceBadge. In this case download the information needed to make a new
	// PlaceBadge.

	footerView.setOnClickListener(new OnClickListener() {

		@Override
		public void onClick(View arg0) {


               
               
               
               
               
               
               
               
               
               
               
               
               
               
               
               
		}

	});

	placesListView.addFooterView(footerView);
	mAdapter = new PlaceViewAdapter(getApplicationContext());
	setListAdapter(mAdapter);

}