I added a new Progress bar lib to my project. I added it through the maven. Then i used the progress bar in my layout file. While running the App it shows this Error.
Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.github.castorflex.android.circularprogressbar.CircularProgressBar
This is the Library i am using https://github.com/castorflex/SmoothProgressBar.
My layout File
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame">
<ListView
android:id="#+id/feed_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.github.castorflex.android.circularprogressbar.CircularProgressBar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:id="#+id/progressBar"
app:cpb_color="#FFee44"
app:cpb_colors="#array/colors"
app:cpb_rotation_speed="1.0"
app:cpb_sweep_speed="1.0"
app:cpb_stroke_width="4dp"
app:cpb_min_sweep_angle="10"
app:cpb_max_sweep_angle="300"
/>
</FrameLayout>
My Class
public class VideoActivity extends Activity {
private static final String TAG = "Mine";
private static final int REQ_START_STANDALONE_PLAYER = 1;
private static final int REQ_RESOLVE_SERVICE_MISSING = 2;
public static final String DEVELOPER_KEY = "AIzaSyDcnoqJGI1872s";
public ListView listView;
private FeedListAdapter listAdapter;
private List<FeedItem> feedItems;
public String mvideoid;
public String mstatus;
ProgressBar progressBar;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed_list);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar.setVisibility(View.VISIBLE);
listView = (ListView) findViewById(R.id.feed_list);
feedItems = new ArrayList<FeedItem>();
listAdapter = new FeedListAdapter(this, feedItems);
listView.setAdapter(listAdapter);
// making fresh volley request and getting json
GsonRequest<FeedResult> gsonRequest = new GsonRequest<FeedResult>(URL_FEED, FeedResult.class,
new Response.Listener<FeedResult>() {
#Override
public void onResponse(FeedResult response) {
feedItems = response.getFeedItems();
listAdapter.setData(feedItems);
listAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.INVISIBLE);
}
},
new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "Error: " + error.getMessage());
}
});
// Adding request to volley request queue
AppController.getInstance().addRequest(gsonRequest, TAG);
getid();
}
}
Try to replace with this :
xmlns:app="http://schemas.android.com/apk/res/com.android.demo"
this value (com.android.demo) replace with your package name.
if you are using any custom component refer it with the same name i.e.
import com.github.castorflex.android.circularprogressbar.CircularProgressBar;
public class VideoActivity extends Activity {
CircularProgressBar progressBar;
.
.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed_list);
progressBar = (CircularProgressBar) findViewById(R.id.progressBar);
.
.
.
you are using the default one which isn't present in xml
Related
I have implemented SearchView with RecyclerView but I am getting an error.
I am developing android weather app and I want to implement function when user launch app user can search cityName when the user hits names it should display cityName and weather information a user can also add city add and remove it but I have followed this tutorial for SearchView searchviewtutorial
but I am getting this error
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)' on a null object reference
at yodgobekkomilov.edgar.com.weather.MainActivity.onCreate(MainActivity.java:47)
I have followed this link but did not solve the issue.
below my MainActivity.java file where I have implemented SearchView with Recyclerview
public class MainActivity extends AppCompatActivity {
private List<Weather> weatherArrayList;
private List<ForecastEndingPoint> conditionList;
private ProgressDialog pDialog;
private RecyclerView recyclerView;
private SearchView mSearchView;
private WeatherAdapter adapter;
private ConditionAdapter conditionAdapter;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mSearchView = (SearchView) findViewById(R.id.searchView);
pDialog = new ProgressDialog(MainActivity.this);
pDialog.setMessage("Loading Data.. Please wait...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
//Creating an object of our api interface
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
#Override
public boolean onQueryTextSubmit(String query) {
ApiService api = WeatherClient.getApiService();
/**
* Calling JSON
*/
Call<List<Weather>> call = api.getWeather("6bed69052a864d44a8e165653183008", "Andijan");
/**
* Enqueue Callback will be call when get response...
*/
call.enqueue(new Callback<List<Weather>>() {
#Override
public void onResponse(Call<List<Weather>> call, Response<List<Weather>> response) {
//Dismiss Dialog
// Log.d("url", call.request().url().toString());
pDialog.dismiss();
if (response.isSuccessful()) {
/**
* Got Successfully
*/
weatherArrayList = response.body();
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
LinearLayoutManager eLayoutManager = null;
adapter = new WeatherAdapter((List<Weather>) weatherArrayList);
eLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(eLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
}
}
#Override
public void onFailure(Call<List<Weather>> call, Throwable t) {
pDialog.dismiss();
}
});
getApi();
return false;
}
#Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
public void getApi(){
ApiService apiService = WeatherClient.getApiService();
Call<ForecastEndingPoint> conditionCall = apiService.forecast("6bed69052a864d44a8e165653183008", "Andijan", 5);
conditionCall.enqueue(new Callback<ForecastEndingPoint>() {
#Override
public void onResponse(Call<ForecastEndingPoint> conditionCall, Response<ForecastEndingPoint> response) {
//Dismiss Dialog
// Log.d("url", call.request().url().toString());
if (pDialog != null && pDialog.isShowing()) {
pDialog.dismiss();
}
if (response.isSuccessful()) {
/**
* Got Successfully
*/
conditionList = Collections.singletonList(response.body());
recyclerView = findViewById(R.id.recycler_view);
LinearLayoutManager eLayoutManager = null;
Context context = getApplicationContext();
Context picassoContext = getApplicationContext();
conditionAdapter = new ConditionAdapter(conditionList, context, picassoContext);
eLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(eLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(conditionAdapter);
}
}
#Override
public void onFailure(Call<ForecastEndingPoint> conditionCall, Throwable t) {
pDialog.dismiss();
}
});
}
}
below my activity_main.xml file where I have hosted recyclerview.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/recycler_view"
android:fadeScrollbars="true"
android:scrollbars="vertical"/>
</RelativeLayout>
below search.xml where I have implemented Searchview
<android.support.design.widget.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.SearchView
android:id="#+id/searchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:queryHint="Search Here"
android:layout_centerHorizontal="true" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
If you see in the tutorial it's "SearchView", not "android.support.v7.widget.SearchView". Change it to "SearchView".
That's an simple null pointer exception. you did not share the whole error but at the end off the error you get some line number where the error come from.just click on that and compiler automatically direct to that line.
make sure that you did not using any variable with out initializing it.
writelist<Weather> = new ArrayList() instead of just writing list<Weather>.
I am trying to implement "Swipe to load more" method in my application but I got that error when I swipe down in the first time. This is what it showed in the console:
E/SwipeRefreshLayout: Got ACTION_MOVE event but don't have an active
pointer id. E/SwipeRefreshLayout: Got ACTION_MOVE event but don't have
an active pointer id. E/SwipeRefreshLayout: Got ACTION_MOVE event but
don't have an active pointer id. E/SwipeRefreshLayout: Got ACTION_MOVE
event but don't have an active pointer id.
This is my layout code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="training.com.chatgcmapplication.ChatActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipeLayout"
android:layout_width="match_parent"
android:layout_height="380dp">
<ListView
android:id="#+id/listMessage"
android:layout_width="match_parent"
android:layout_height="380dp"
android:layout_alignParentLeft="false"
android:layout_alignParentTop="false"
android:divider="#null"
android:listSelector="#android:color/transparent"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll" />
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:id="#+id/txt_chat"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.92"
android:inputType="text" />
<Button
android:id="#+id/btn_send"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="30dp"
android:text="#string/btn_send" />
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
And when I swipe in the second time: it load double data.
This is ChatActivity, what implement that method:
public class ChatActivity extends AppCompatActivity implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener {
private static EditText txt_chat;
private String registId;
private String chatTitle;
private MessageSender mgsSender;
private int userId;
private DatabaseHelper databaseHelper;
private TimeUtil timeUtil;
private MessageAdapter messageAdapter;
private int offsetNumber = 5;
private SwipeRefreshLayout swipeRefreshLayout;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
Button btn_send = (Button) findViewById(R.id.btn_send);
txt_chat = (EditText) findViewById(R.id.txt_chat);
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeLayout);
swipeRefreshLayout.setOnRefreshListener(this);
ListView lv_message = (ListView) findViewById(R.id.listMessage);
timeUtil = new TimeUtil();
databaseHelper = DatabaseHelper.getInstance(getApplicationContext());
btn_send.setOnClickListener(this);
Bundle bundle = getIntent().getExtras();
chatTitle = bundle.getString("titleName");
if (getIntent().getBundleExtra("INFO") != null) {
chatTitle = getIntent().getBundleExtra("INFO").getString("name");
this.setTitle(chatTitle);
} else {
this.setTitle(chatTitle);
}
registId = bundle.getString("regId");
userId = databaseHelper.getUser(chatTitle).getUserId();
List<Message> messages = databaseHelper.getLastTenMessages(AppConfig.USER_ID, databaseHelper.getUser(chatTitle).getUserId(), 0);
messageAdapter = new MessageAdapter(getApplicationContext(), R.layout.chat_item, (ArrayList<Message>) messages);
LocalBroadcastManager.getInstance(this).registerReceiver(onNotice, new IntentFilter("Msg"));
if (messages.size() > 0) lv_message.setAdapter(messageAdapter);
}
private BroadcastReceiver onNotice = new BroadcastReceiver() {
#Override
public void onReceive(Context context, Intent intent) {
String message = intent.getStringExtra("message");
try {
Message messageObj = new Message();
messageObj.setMessage(message);
messageObj.setUserId(userId);
messageObj.setSender_id(AppConfig.USER_ID);
messageObj.setExpiresTime(timeUtil.formatDateTime(timeUtil.getCurrentTime()));
messageAdapter.add(messageObj);
} catch (ParseException e) {
e.printStackTrace();
}
messageAdapter.notifyDataSetChanged();
}
};
#Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
#Override
protected void onDestroy() {
LocalBroadcastManager.getInstance(this).unregisterReceiver(onNotice);
super.onDestroy();
}
private static MessageSenderContent createMegContent(String regId, String title) {
String message = txt_chat.getText().toString();
MessageSenderContent mgsContent = new MessageSenderContent();
mgsContent.addRegId(regId);
mgsContent.createData(title, message);
return mgsContent;
}
#Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_send:
String message = txt_chat.getText().toString();
databaseHelper = DatabaseHelper.getInstance(getApplicationContext());
mgsSender = new MessageSender();
new AsyncTask<Void, Void, Void>() {
#Override
protected Void doInBackground(Void... params) {
MessageSenderContent mgsContent = createMegContent(registId, AppConfig.USER_NAME);
mgsSender.sendPost(mgsContent);
return null;
}
}.execute();
databaseHelper.addMessage(message, timeUtil.getCurrentTime(), userId, AppConfig.USER_ID);
txt_chat.setText("");
try {
Message messageObj = new Message();
messageObj.setMessage(message);
messageObj.setUserId(AppConfig.USER_ID);
messageObj.setSender_id(userId);
messageObj.setExpiresTime(timeUtil.formatDateTime(timeUtil.getCurrentTime()));
messageAdapter.add(messageObj);
} catch (ParseException e) {
e.printStackTrace();
}
messageAdapter.notifyDataSetChanged();
break;
}
}
#Override
public void onRefresh() {
swipeRefreshLayout.setRefreshing(true);
List<Message> messages = databaseHelper.getLastTenMessages(AppConfig.USER_ID, databaseHelper.getUser(chatTitle).getUserId(), offsetNumber);
messageAdapter.insertToTheFirst(messages);
messageAdapter.notifyDataSetChanged();
offsetNumber += 5;
Log.i("Offset number", offsetNumber + "");
swipeRefreshLayout.setRefreshing(false);
}
}
UPDATE ISSUE's REASON
I found the reason of that issue. It due to I force the listview scroll to the bottom when it init with this code :
android:stackFromBottom="true"
I replace that code with this but still have same issue:
lv_message.post(new Runnable() {
#Override
public void run() {
lv_message.setSelection(lv_message.getCount() -1);
}
});
I think the problem is , You are trying to show , dismiss and refresh swipeRefreshLayout inside the same method i.e onRefresh().
Make seperate methods for showing and dismissing dialog and invoke them from the place where they are required as I have done below:
#Override
public void onRefresh() {
// refresh code here.
}
#Override
public void showDialog() {
swipeRef.post(new Runnable() {
#Override
public void run() {
if(swipeRef != null)
swipeRef.setRefreshing(true);
}
});
}
#Override
public void dismissDialog() {
if(swipeRef!=null && swipeRef.isShown() )
swipeRef.setRefreshing(false);
}
Here I try to make a app.
First it shows a home page.It will display 2 sec.
Here is the code...
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
int secondsDelayed = 3;
new Handler().postDelayed(new Runnable() {
public void run() {
startActivity(new Intent(MainActivity.this,SocondActivity.class));
finish();
}
}, secondsDelayed * 1000);
}
}
Then my second activity want to show a splash view until json string download from the rest service.
Here is my code....
public class SocondActivity extends Activity {
private static final String TAG = "SocondActivity";
//please assume my url is OK
private static String url = "my url";
private String jsonStr;
private final int SPLASH_DISPLAY_LENGTH = 5000;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
new GetContacts().execute();
Log.d(TAG,jsonStr);
Intent mainIntent = new Intent(SocondActivity.this,
ThirdActivity.class);
SocondActivity.this.startActivity(mainIntent);
SocondActivity.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
private class GetContacts extends AsyncTask<Void, Void, Void> {
#Override
protected void onPreExecute() {
super.onPreExecute();
}
protected Void doInBackground(Void... arg0) {
//please assume that my Server Handler class is working fine
ServiceHandler sh = new ServiceHandler();
jsonStr = sh.makeServiceCall(url, ServiceHandler.GET);
return null;
}
}
}
Then I got this error......
java.lang.NullPointerException: println needs a message
Because the jsonStr was empty....
Why is that ??
Here is my R.layout.splash_screen
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/loadingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:scaleType="center"
android:src="#drawable/calendar_50" />
<ProgressBar
android:layout_below="#id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
</LinearLayout>
Can someone please tell me Is this method is correct and what should I change to make this correct ??
You have a race case. You need to do something like this.
Instead of utilizing a handler in onCreate like you are below (which is only serving to create a layer of complexity that isn't functioning like you expect)
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
new GetContacts().execute();
Log.d(TAG,jsonStr);
Intent mainIntent = new Intent(SocondActivity.this,
ThirdActivity.class);
SocondActivity.this.startActivity(mainIntent);
SocondActivity.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
Just call this in your onCreate()
new GetContacts().execute();
And in your AsyncTask, override the method onPostExecute like so
#Override
public void onPostExecute(Void voidParam){
Log.d(TAG,jsonStr);
Intent mainIntent = new Intent(SocondActivity.this,ThirdActivity.class);
SocondActivity.this.startActivity(mainIntent);
SocondActivity.this.finish();
}
This will tell your app that you want to execute the AsyncTask, and when you are done (and only when you are done) you want to launch your next Activity. This removes the race case as well as the need for a handler/runnable.
When I start activity with ListView it start to load some information from the Internet and after apply adapter, but during loading ListVIew doesn't show me a ProgressBar ring. When I trying to use SherlockListActivity instead ListView I have same problem.
<?xml version="1.0" encoding="utf-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/comments"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
public class CommentsActivity extends SherlockActivity{
#InjectView(R.id.comments) ListView mCommentsListView;
private String mPostId;
private CommentsAdapter mAdapter;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.comment_activivty);
ButterKnife.inject(this);
Intent intent = getIntent();
mPostId = intent.getStringExtra("POST_ID");
LC lc = new LC();
lc.execute(mPostId);
}
public void setupAdapter(){
mAdapter = new CommentsAdapter(this);
mCommentsListView.setAdapter(mAdapter);
}
private class LC extends LoadComments{
#Override
protected void onPostExecute(Void result) {
//setup adapter after loading comments
setupAdapter();
}
}
}
Add ProgressBar to your layout file:
<ProgressBar
android:id="#+id/progress_bar"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Inject the ProgressBar in your activity:
#InjectView(R.id.progress_bar) ProgressBar mProgressBar;
Now you have to hide it when the adapter is set:
public void setupAdapter(){
mAdapter = new CommentsAdapter(this);
mCommentsListView.setAdapter(mAdapter);
mProgressBar.setVisibility(View.GONE);
}
Do it like this,
#Override
protected Void OnPreExecute(){
ProgressDialog prgDialog = new ProgressDialog(getContext());
prgDialog.setTitle("Loading");
prgDialog.setMessage("please wait")
prgDialog.setCancelable(false);
prgDialog.show();
}
on post Execute
private class LC extends LoadComments{
#Override
protected void onPostExecute(Void result) {
//setup adapter after loading comments
prgDialog.dismiss();
setupAdapter();
}
}
This is my xml file:
<ProgressBar
android:id="#+id/progress_index"
style="#android:style/Widget.ProgressBar.Inverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"/>
<ListView
android:id="#+id/listview_index"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="outsideInset">
</ListView>
I try to mProgress.setVisibility(View.GONE) after mListView.setAdapter() ,but when I check the "Show layout bounds" in the "Developer options".The layout not actually gone.As the picture shows,the ProgressBar is still in the center of the FrameLayout.Why?
Java code:
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mProgress = (ProgressBar) view.findViewById(R.id.progress_index);
mProgress.setVisibility(View.VISIBLE);
mAdapter = new CustomAdapter(getActivity());
new MyTask().execute();
lv.setAdapter(mAdapter);
}
public class MyTask extends AsyncTask<Integer, Void, ArrayList<NewsItem>> {
protected ArrayList<NewsItem> doInBackground(Integer... params) {
// some execution....
}
protected void onPostExecute(ArrayList<NewsItem> result) {
mAdapter.notifyDataSetChanged();
mProgress.setVisibility(View.GONE);
mListView.setVisibility(View.VISIBLE);
}
}
can you try this:
ProgressDialog mProgress = new ProgressDialog(activity.this);
...........
mProgress.dismiss();