I will try to be brief and precise:
I have a user object that contains a chat, and this is updated every time I receive a message:
public class Usuarios implements Serializable {
private static final long serialVersionUID = 1113799434508676095L;
private int id;
private String nombre;
private String ip;
private boolean isSInicial;
//HERE WILL GO THE VARIABLE THAT STORMS THE CHAT, BUT I DO NOT KNOW HOW TO IMPLEMENT IT
public Usuarios(int id, String nombre, String ip, boolean isSInicial){
this.id = id;
this.nombre = nombre;
this.ip = ip;
this.isSInicial = isSInicial;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public boolean isSInicial() {
return isSInicial;
}
public void setSInicial(boolean SInicial) {
isSInicial = SInicial;
}}
I have an activity, that by clicking on a list, loads a new activity for the specific user:
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
#Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) {
Usuarios e = (Usuarios) listview.getItemAtPosition(pos);
Intent visorDetalles = new Intent(view.getContext(),Chat.class);
if(Contactos.listaDeContactos.indexOf(e) >= 0) {
visorDetalles.putExtra("indice", Contactos.listaDeContactos.indexOf(e));
startActivity(visorDetalles);
}
else{
Toast.makeText(contexto,"Usuario fuera de linea",Toast.LENGTH_LONG);
}
}
});
I need the EditText that contains the Intent to be updated automatically every time I click on a user of a ListView.
I do not know what kind of variable I should use in the user object and how to implement it.
In your Usuarios class add the variable:
public ArrayList<String> currentChat;
Instead of passing the index, pass the Object himself maybe.
if(Contactos.listaDeContactos.indexOf(e) >= 0) {
visorDetalles.putExtra("usuario",e);
startActivity(visorDetalles);
}
else{
Toast.makeText(contexto,"Usuario fuera de linea",Toast.LENGTH_LONG);
}
And in your onCreate Chat Activity
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
Intent intent = getIntent();
Usuario usuario = (Usuario) intent.getSerializableExtra("usuario");
EditText myEditText = (EditText)findViewById(R.id.myEditText1));
String allChat;
for(String chatLine : usuario.currentChat) {
allChat += chatLine + '\n';
}
myEditText.setText(allChat);
Did I got your problem right ?
Related
I want the Validation for the mobile number ,Am enter the edit text value search with database i want get the error already register your number for the validation setError Or Toast message,Add the Main class, Model class and AppUtil class kindly help me , Am attached code given below. Please tell what i set validation.
public class CreateRyotManagerFragment extends Fragment {
EditText mRyotName, mRyotFatherName, mAddress, mIdNo, mMobile1;
Spinner mDivision;
List<RyotMasterDb> mRyotList;
List<DivitionMasterDb> mDistrickarray;
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.layout_new_ryot, container, false);
mMobile1 = view.findViewById(R.id.mobile);
mDivision = view.findViewById(R.id.divition);
mRyotList = AppUtils.getRyotMasterList();
mDistrickarray = AppUtils.getDistrictMasterLIst();
SpinnerAfdapterDistric divisionAdapter = new SpinnerAfdapterDistric(getActivity().getApplicationContext(), mDistrickarray);
mDivision.setAdapter(divisionAdapter);
}
}
#Table(name = "ryotMasterDB", database = AppDatabase.class)
RyotMasterDb extends Model implements Serializable {
#PrimaryKey
public Long id;
#Column(name = "mobile_1")
public String mobile_1;
#Column(name = "mobile_2")
public String mobile_2;
#Column(name = "zone_group_id")
public String zone_group_id;
#Column(name = "bank_id")
public String bank_id;
#Column(name = "branch_id")
public String branch_id;
#Column(name = "sb_ac_no")
public String sb_ac_no;
#Column(name = "state")
public String state;
#Column(name = "remoteID")
public String remoteID;
public RyotMasterDb() {
}
public RyotMasterDb(String remoteId, String imageData, String ryotNo, String catId, String name, String fatherName, String divId, String secID, String villID, String address, String address1, String add2, String add3, String iiSourceID, String irrType, String totalArea, String suitableArea, String pCode, String disID, String talukID, String firID, String factID, String pontentialRyot, String idProof, String idNo, String mobile1, String mobil2m,String passbook_image, String id_proof_image, String id_proof_back_side_image) {
this.remoteID = remoteId;
this.id = Long.getLong(remoteId);
this.mobile_1 = mobile1;
this.mobile_2 = mobil2m;
this.zone_group_id = zoneGroup;
this.bank_id = bankID;
this.branch_id = branchID;
this.sb_ac_no = sbAccNO;
this.state = state;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getMobile_1() {
return mobile_1;
}
public void setMobile_1(String mobile_1) {
this.mobile_1 = mobile_1;
}
public String getMobile_2() {
return mobile_2;
}
public void setMobile_2(String mobile_2) {
this.mobile_2 = mobile_2;
}
public String getZone_group_id() {
return zone_group_id;
}
public void setZone_group_id(String zone_group_id) {
this.zone_group_id = zone_group_id;
}
public String getBank_id() {
return bank_id;
}
public void setBank_id(String bank_id) {
this.bank_id = bank_id;
}
public String getBranch_id() {
return branch_id;
}
public void setBranch_id(String branch_id) {
this.branch_id = branch_id;
}
public String getSb_ac_no() {
return sb_ac_no;
}
public void setSb_ac_no(String sb_ac_no) {
this.sb_ac_no = sb_ac_no;
}
}
public class AppUtils {
static Fragment mFragment;
public static List<RyotMasterDb> getRyotMasterList() {
return Select.from(RyotMasterDb.class).fetch();
}
}
I suggest you use AutoCompleteTextView. An editable text view that shows completion suggestions automatically while the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.
The drop down can be dismissed at any time by pressing the back key or, if no item is selected in the drop down, by pressing the enter/dpad center key.
The list of suggestions is obtained from a data adapter and appears only after a given number of characters defined by the threshold.
Code Sample:
public class CountriesActivity extends Activity {
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.countries);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView)
findViewById(R.id.countries_list);
textView.setAdapter(adapter);
}
private static final String[] COUNTRIES = new String[] {
"Belgium", "France", "Italy", "Germany", "Spain"
};
}
You can refer to this example for a detailed explanation.
You can set a keyListener for your EditText
editText.setOnKeyListener(new View.OnKeyListener() {
#Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_DOWN && keycode == KeyEvent.KEYCODE_ENTER){
// do your search in here
String mobileno=mmobile.getText().toString();
//search it
boolean isInList = checkIsPhoneNumberInList(mRyotList,mobileno);
Log.i("CheckResult","is my phone number "+mobileno+" in mRyotList: "+isInList);
if(isInList){
Toast.makeText(getActivity(),"your phone number is already registered",Toast.Toast.LENGTH_LONG).show();
}
}
return false;
}
});
for check whether phone which you input in your edittext is in your database by this method
private boolean checkIsPhoneNumberInList(List<RyotMasterDb> mRyotList,String phoneNumber){
if (mRyotList == null || phoneNumber == null) {
return false;
}
boolean isIn = false;
for (RyotMasterDb rm: mRyotList) {
if (phoneNumber.equals(rm.getMobile_1())||phoneNumber.equals(rm.getMobile_2())){
isIn = true;
}
}
return isIn;
}
Main activity.java
public class activity_3 extends AppCompatActivity {
TextView question,option_1,option_2,option_3,description,winnner;
NumberProgressBar option_progress1, option_progress2,option_progress3;
int val_1;
int val_2;
int val_3;
DatabaseReference Polldata_3;
String optionOne;
String optionTwo;
String optionThree;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_3);
final String que = getIntent().getExtras().getString("que");
final String des = getIntent().getExtras().getString("des");
optionOne = getIntent().getExtras().getString("option1");
optionTwo = getIntent().getExtras().getString("option2");
optionThree = getIntent().getExtras().getString("option3");
final String id_user = getIntent().getExtras().getString("id");
val_1 = getIntent().getExtras().getInt("val1");
val_2 = getIntent().getExtras().getInt("val2");
val_2 = getIntent().getExtras().getInt("val3");
option_progress1 = (NumberProgressBar) findViewById(R.id.option1_progressbar);
option_progress2 = (NumberProgressBar) findViewById(R.id.option2_progressbar);
option_progress3 = (NumberProgressBar) findViewById(R.id.option3_progressbar);
Polldata_3 = FirebaseDatabase.getInstance().getReference("POll").child("poll_3");
final DatabaseReference answsersave = Polldata_3.child(id_user);
question = (TextView) findViewById(R.id.question_showpoll);
option_1 = (TextView) findViewById(R.id.option_1);
option_2 = (TextView) findViewById(R.id.option_2);
option_3 = (TextView) findViewById(R.id.option_3);
description = (TextView) findViewById(R.id.description_user_3);
winnner = (TextView) findViewById(R.id.winner);
option_1.setText(optionOne);
option_2.setText(optionTwo);
option_3.setText(optionThree);
question.setText(que);
description.setText(des);
option_progress1.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
option_progress1.setProgress(val_1+1);
option_progress1.setEnabled(false);
option_progress2.setEnabled(false);
option_progress3.setEnabled(false);
val_1++;
answsersave.child("option_1_value").setValue(val_1);
//winnerdeclare();
}
});
option_progress2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
option_progress2.setProgress(val_2+1);
option_progress1.setEnabled(false);
option_progress2.setEnabled(false);
option_progress3.setEnabled(false);
val_2++;
answsersave.child("option_2_value").setValue(val_2);
// winnerdeclare();
}
});
option_progress3.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
option_progress3.setProgress(val_3+1);
option_progress1.setEnabled(false);
option_progress2.setEnabled(false);
option_progress3.setEnabled(false);
val_3++;
// winnerdeclare();
answsersave.child("option_3_value").setValue(val_3);
}
});
}
}
ADAPTER CLASS
public class listview_3 extends AppCompatActivity {
ListView listviewpoll3;
private DatabaseReference Poll_data_3;
List<addpoll_3> addpoll_3List;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_listview_3);
listviewpoll3 = (ListView) findViewById(R.id.poll_listview_3);
Poll_data_3 = FirebaseDatabase.getInstance().getReference("POll").child("poll_3");
addpoll_3List = new ArrayList<>();
listviewpoll3.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> adapter, View v, int position, long id) {
Intent intent = new Intent(listview_3.this, activity_3.class);
addpoll_3 poll = addpoll_3List.get(position);
final String optionone = poll.getOption_1();
final String optiontwo = poll.getOption_2();
final String optionthree = poll.getOption_3();
final String id_user = poll.getId();
final int value_1 = poll.getOption_1_value();
final int value_2 = poll.getOption_2_value();
final int value_3 = poll.getOption_3_value();
final String question = poll.getQuestion();
final String desp = poll.getDescription();
intent.putExtra("option1",optionone);
intent.putExtra("option2",optiontwo);
intent.putExtra("option3",optionthree);
intent.putExtra("id",id_user);
intent.putExtra("val1",value_1);
intent.putExtra("val2",value_2);
intent.putExtra("val3",value_3);
intent.putExtra("que",question);
intent.putExtra("descp",desp);
startActivity(intent);
}
});
}
#Override
protected void onStart() {
super.onStart();
Poll_data_3.addValueEventListener(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
addpoll_3List.clear();
for(DataSnapshot pollSnapshot: dataSnapshot.getChildren())
{
addpoll_3 poll = pollSnapshot.getValue(addpoll_3.class);
addpoll_3List.add(poll);
}
poll_list_3 adapter = new poll_list_3(listview_3.this,addpoll_3List);
listviewpoll3.setAdapter(adapter);
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
}
list class
public class poll_list_3 extends ArrayAdapter<addpoll_3> {
private Activity context;
private List<addpoll_3> addpoll_3List;
public poll_list_3(Activity context, List<addpoll_3> addpoll_3List) {
super(context, R.layout.list_layout, addpoll_3List);
this.context = context;
this.addpoll_3List = addpoll_3List;
}
#NonNull
#Override
public View getView(int position, #Nullable View convertView, #NonNull ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View viewitem = inflater.inflate(R.layout.list_layout,null);
TextView textViewName = (TextView) viewitem.findViewById(R.id.tv);
TextView textViewDesp = (TextView) viewitem.findViewById(R.id.tv1);
final addpoll_3 poll1 = addpoll_3List.get(position);
textViewName.setText(poll1.getQuestion());
textViewDesp.setText(poll1.getDescription());
return viewitem;
}
}
I am making a polling app where user can create a poll which is then stored in the firebase database and retrieved into listview of the app
when the user clicks on the list view he is directed to the the activity where there are number of progressbars
i have added a ON-click listener o the progress bar, So when user clicks on the progressbar the val of that option gets incremented in the database. so when a different user vote on the same poll the value from the database is fetched and value of the current user is added displaying the winner,but problem is the value of the progressbar1 gets the value from the database but the other two keep progress bar values start from 0 every time user clicks on the other two progress bar (ie 2 and 3).
please help
addpoll_3.java
public class addpoll_3 {
String id;
String question;
String description;
String option_1;
String option_2;
String option_3;
int option_1_value;
int option_2_value;
int option_3_value;
public addpoll_3(){}
public addpoll_3(String id, String question, String description, String option_1, String option_2, String option_3, int option_1_value, int option_2_value, int option_3_value) {
this.id = id;
this.question = question;
this.description = description;
this.option_1 = option_1;
this.option_2 = option_2;
this.option_3 = option_3;
this.option_1_value = option_1_value;
this.option_2_value = option_2_value;
this.option_3_value = option_3_value;
}
public String getId() {
return id;
}
public String getQuestion() {
return question;
}
public String getDescription() {
return description;
}
public String getOption_1() {
return option_1;
}
public String getOption_2() {
return option_2;
}
public String getOption_3() {
return option_3;
}
public int getOption_1_value() {
return option_1_value;
}
public int getOption_2_value() {
return option_2_value;
}
public int getOption_3_value() {
return option_3_value;
}
}
code:
Activity_3.java
val_1 = getIntent().getExtras().getInt("val1");
val_2 = getIntent().getExtras().getInt("val2");
val_3 = getIntent().getExtras().getInt("val3");
These were changes to be made
//Read from the database
myRef.addValueEventListener(new ValueEventListener()
{
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
String value = dataSnapshot.getValue(String.class);
Log.d(TAG, "Value is: " + value);
}
#Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Log.w(TAG, "Failed to read value.", error.toException());
}
});
I have the following model class:
#SuppressWarnings("serial")
public class Cheltuiala implements Serializable {
private int id;
private Date data;
private String tip;
private float pret;
public Cheltuiala() {
}
public Cheltuiala(Date data, String tip, float pret) {
this.data = data;
this.tip = tip;
this.pret = pret;
}
public int getId() {
return id;
}
public Date getData() {
return data;
}
public String getTip() {
return tip;
}
public float getPret() {
return pret;
}
public void setId(int id) {
this.id = id;
}
public void setData(Date data) {
this.data = data;
}
public void setTip(String tip) {
this.tip = tip;
}
public void setPret(float pret){
this.pret = pret;
}
#Override
public String toString() {
return "id:" + id + " data:" + data + " tip:" + tip + " pret:" + pret;
}
}
Here is the method from the DetailsActivity that extends Activity:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details); // legatura dintre activitate si view
Intent intent = getIntent(); //continutul cu care s-a apelat
final Cheltuiala cheltuiala = (Cheltuiala) intent.getSerializableExtra("cheltuiala");
System.out.println(cheltuiala.getData());
EditText data = (EditText) findViewById(R.id.editTextData);
data.setText(cheltuiala.getData().toString());
EditText tip = (EditText) findViewById(R.id.editTextTip);
System.out.println(cheltuiala);
tip.setText(cheltuiala.getTip());
EditText pret = (EditText) findViewById(R.id.editTextPret);
pret.setText(String.valueOf(cheltuiala.getPret()));
}
When I print 'cheltuiala', I see what I want, but when I call get() methods from 'Cheltuiala' class, I got NullPointerException. Does anyone know why ?
as you have use toString() method you can get NPE when getData is null. you can check getData that is null or not and if is not null use .toString()
you can use following code:
data.setText(cheltuiala.getData() == null ? "" : cheltuiala.getData().toString());
as you say when i use every get method that is null might be data is null. check that you have editTextData id in activity_details
When I put an object into a bundle so I can transfer it to another Activity, changing the value of the attribute IdEscritorio occurs.
In my LoginActivity IdEscritorio the value of = 1, when I get in my Main Activity is it with the value of 7.
LogCat
LoginActivity Method
private void IniciarMainActivity(Usuario usuarioAutenticado)
{
//Iniciar Activity Main
Intent i = new Intent(LoginActivity.this, MainActivity.class);
Bundle b = new Bundle();
b.putParcelable("usuarioAutenticado", usuarioAutenticado);
Log.d(TAG, "IdEscritorio: " + String.valueOf(usuarioAutenticado.getIdEscritorio()));
i.putExtras(b);
startActivity(i);
}
MainActivity onCreate()
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Widgets
InicializeComponents();
//Listeners Events
Listeners();
//Recuperar os valores de usuario autenticado enviado da activity Login
_usuarioAutenticado = new Usuario();
Bundle bundle = getIntent().getExtras();
if(bundle != null)
_usuarioAutenticado = bundle.getParcelable("usuarioAutenticado");
Log.d(TAG, "IdEscritorio: " + String.valueOf(_usuarioAutenticado.getIdEscritorio()));
}
Class Usuario
public class Usuario implements Parcelable {
private int Id;
private int IdEscritorio;
private String Nome;
private String Login;
private String Senha;
/**
* Construtores
*/
public Usuario()
{
super();
}
public Usuario(Parcel parcel)
{
this();
this.Id = parcel.readInt();
this.IdEscritorio = parcel.readInt();
this.Nome = parcel.readString();
this.Login = parcel.readString();
this.Senha = parcel.readString();
}
/**
* Propriedades
*/
public void setId(int id) {
Id = id;
}
public int getId() {
return Id;
}
public int getIdEscritorio() {
return IdEscritorio;
}
public void setIdEscritorio(int idEscritorio) {
IdEscritorio = idEscritorio;
}
public String getNome() {
return Nome;
}
public void setNome(String nome) {
Nome = nome;
}
public String getLogin() {
return Login;
}
public void setLogin(String login) {
Login = login;
}
public String getSenha() {
return Senha;
}
public void setSenha(String senha) {
Senha = senha;
}
#Override
public int describeContents() {
return 0;
}
#Override
public void writeToParcel(Parcel out, int flags)
{
out.writeInt(getId());
out.writeString(getNome());
}
public static final Parcelable.Creator<Usuario> CREATOR = new Parcelable.Creator<Usuario>(){
#Override
public Usuario createFromParcel(Parcel in){
return new Usuario(in);
}
#Override
public Usuario[] newArray(int size) {
return new Usuario[size];
}
};
}
The problem is with your Parcelable class. In your writeToParcel class, you are writing only Id and Nome to the Parcel.
#Override
public void writeToParcel(Parcel out, int flags)
{
out.writeInt(getId());
out.writeString(getNome());
}
However, you are reading all 5 fields when creating the object in Usuario(Parcel parcel).
For this to work correctly, change your writeToParcel method to:
public void writeToParcel(Parcel out, int flags)
{
out.writeInt(getId());
out.writeInt(getIdEscritorio());
out.writeString(getNome());
out.writeString(getLogin());
out.writeString(getSenha());
}
Hello I'm new at Android. I want to populate a Spinner with a list of objects. I have googled how to do it but I just find examples with an array of strings.
Can any one help me?
This is my code:
Categories class:
public class Categories
{
#com.google.gson.annotations.SerializedName("id")
private String mId;
#com.google.gson.annotations.SerializedName("name")
private String mName;
public Categories()
{}
public Categories(String id, String name)
{
this.setId(id);
this.setName(name);
}
#Override
public String toString()
{
return mName;
}
// ******** GET *************
public String getId()
{
return mId;
}
public String getName()
{
return mName;
}
// ******** SET *************
public final void setId(String id)
{
mId = id;
}
public final void setName(String name)
{
mName = name;
}
}
This is my Activity code:
public class AgregarActividadActivity extends ActionBarActivity
{
private MobileServiceClient mClient;
private MobileServiceTable<Activities> mActivitiesTable;
private MobileServiceTable<Categories> mCategoriesTable;
private MobileServiceTable<Projects> mProjectsTable;
private EditText mTxtTitulo;
private EditText mTxtDescr;
String categryId = null;
List<Categories> catList = new ArrayList<Categories>();
Spinner spEstado;
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_agregar_actividad);
try
{
mClient = new MobileServiceClient(
"https://site.azure-mobile.net/",
"AppKey",
this);
mActivitiesTable = mClient.getTable(Activities.class);
mCategoriesTable = mClient.getTable(Categories.class);
}
catch (MalformedURLException e)
{
createAndShowDialogExc(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error");
}
mTxtTitulo = (EditText) findViewById(R.id.txtTitulo);
mTxtDescr = (EditText) findViewById(R.id.txtDescripcion);
getCategories();
spEstado = (Spinner)this.findViewById(R.id.spEstado);
ArrayAdapter<Categories> Adapter = new ArrayAdapter<Categories>(this,
android.R.layout.simple_spinner_item, catList);
Adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spEstado.setAdapter(Adapter);
spEstado.setOnItemSelectedListener(
new AdapterView.OnItemSelectedListener() {
public void onItemSelected(
AdapterView<?> parent,
View view,
int position,
long id) {
Categories item = (Categories) parent.getItemAtPosition(position);
}
public void onNothingSelected(AdapterView<?> parent) {
}
}
);
spProjects = (Spinner)this.findViewById(R.id.spProyecto);
ArrayAdapter<Projects> proAdapter = new ArrayAdapter<Projects>(this,
android.R.layout.simple_spinner_item, proList);
proAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spProjects.setAdapter(proAdapter);
}
private void getCategories()
{
mCategoriesTable.execute(new TableQueryCallback<Categories>()
{
public void onCompleted(List<Categories> result, int count, Exception exception, ServiceFilterResponse response)
{
if (exception == null)
{
for (Categories item : result)
{
catList.add(item);
}
}
else
{
createAndShowDialog(exception, "Error");
}
}
});
}
}
I get the dropdownlist with the objects, but when I select one item, it is not displayed as the selected item, when the dropdownlist is hidden.
Any idea will help me! Thank you!!
You need to write a CustomAdapter for this. It is similar to writing a CustomAdapter for a ListView. You can look at Custom Adapter for List View for an idea