AllArea.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//get the place values as popup window
String[] items = {"All-Area","Cheruvathur", "Kanhangad","Nileswaram","Panathur","Periya","Thrikkaripur","Vellarikkundu"};
AlertDialog.Builder builder=new AlertDialog.Builder(context);
builder.setTitle("Choose Area: ");
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item)
{
//AllArea.setText(items[item]);
if(items[item].equals("All-Area"))
{
AllArea.setText(items[item].toString());
//System.out.println(AllArea);
String getAllArea=AllArea.getText().toString();
Intent i=new Intent(SecondPage.this,Order.class);
i.putExtra("getAllArea", getAllArea);
startActivity(i);
Toast.makeText(getApplicationContext(),"All-Area",Toast.LENGTH_SHORT).show();
}
else if(items[item].equals("Cheruvathur"))
{
AllArea.setText(items[item].toString());
Intent j=new Intent(SecondPage.this,Order.class);
String getCheruvathur=AllArea.getText().toString();
j.putExtra("getCheruvathur", getCheruvathur);
startActivity(j);
//System.out.println(AllArea);
Toast.makeText(getApplicationContext(),"Cheruvathur",Toast.LENGTH_SHORT).show();
}
}
}
});
Not able to view the shop name based on the given location and display its name in another activity,
Please help me to figure out what is the problem
code for the selecting value of shop based on location
Intent All=getIntent();
String Allnew=All.getStringExtra("getAllArea");
if (Allnew.equals("All-Area")) {
list = new ArrayList<>();
list.add("3G mobile : Chevtr");
list.add("Spice World : kngd");
list.add("Dotcom : nslrm");
list.add("Pv Stores: Pya");
list.add("Sky World : Pntur");
list.add("Mobile Galaxy : trkppr");
list.add("Dream Mobile : vlkdu");
list.add("Tele World : Chevtr");
list.add("Info Tech Solutions : Pya");
list.add("MYG Mobile : trkppr");
// adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
// listView.setAdapter(adapter);
}
Intent Cheru=getIntent();
String Cherunew=Cheru.getStringExtra("getCheruvathur");
if (Cherunew.equals("Cheruvathur")) {
list1 = new ArrayList<>();
list1.add("3G mobile : Chevtr");
list1.add("Tele World : Chevtr");
// adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list);
// listView.setAdapter(adapter);
}
please help me to figure out the problem log cat showing this is the error
NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equalsIgnoreCase(java.lang.String)' on a null object reference
i