package br.com.automaserv.stocserv.fragments;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import br.com.automaserv.stocserv.R;
import br.com.automaserv.stocserv.StocApplication;
import br.com.automaserv.stocserv.activities.FichaItemProdutoActivity;
import br.com.automaserv.stocserv.model.ORM;
public class ListaProdutosVendaFragment extends StocStringListFragment<ORM.ItemVenda, FichaItemProdutoActivity> {
private TextView tvSubtotal;
private StocApplication app;
public ListaProdutosVendaFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = super.onCreateView(inflater, container, savedInstanceState);
loadAllOnResume = true;
tvSubtotal = (TextView) view.findViewById(R.id.tvSubTotal);
app = getApp();
return view;
}
@Override
public void onStart() {
startTask();
}
private void startTask() {
new Task().execute();
}
private class Task extends AsyncTask<Void, Void, Void> {
private String text;
@Override
protected Void doInBackground(Void... voids) {
Log.d("test","doInBackground");
this.text = "funcionou";
return null;
}
protected void onPostExecute(Void result) {
Log.d("test","onPostExecute");
tvSubtotal.setText(text);
}
}
@Override
protected Class<FichaItemProdutoActivity> getActivityClassName() {
return FichaItemProdutoActivity.class;
}
@Override
protected void loadAll() {
replaceData( app.itensVenda );
}
@Override
public boolean onQueryTextSubmit(String query) {
List<ORM.Produto> res = ORM.Produto.buscar( query );
replaceData(res);
return true;
}
@Override
protected int getLayoutResourceId() {
return R.layout.lista_produtos_venda_fragment;
}
}
Hello everyone! I have the following fragment described above and need to update the contents of the TextSubTextText whenever the fragment is redisplayed. The snippet is a list of items and should display the sum of the items added. But I'm always getting the error "did not call through to super.onResume ()"