Android : Implementing a progressDialog

on Tuesday, September 2, 2014


I want to implement a progessDialog when my class is called. I know how to implement a progressDialog for a fragment class that uses AsyncTask. But here i have a fragment class that doesn't use asyncTask.


What this fragment does is showing some news details when it is called. I want to show a progressDialog while the news is loading and stop the progressDialog when the news is loaded and ready to display.How can i do this? I'm a newbie so please help me


My fragment class



package com.fortuna.cinemalk;

public class NewsDetailFragment extends Fragment {

private ViewPager view1;
private ViewPageAdapter adapter;
private Activity activity;
private CommonVariable commonVariable;


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {

View view = inflater.inflate(R.layout.newsdetail_fragment, container,
false);

activity = this.getActivity();

commonVariable = (CommonVariable) activity.getApplication();

view1 = (ViewPager) view.findViewById(R.id.listviewpager);

adapter = new ViewPageAdapter(commonVariable.getNewsDescription(),
Element.NEWS_DETAIL.getType(), activity);

view1.setAdapter(adapter);



return view;
}

}

0 comments:

Post a Comment