Created
November 12, 2017 15:39
-
-
Save anonymous/9ed517a3146285ec85314bdb6fef0ada to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.locationupdates.event; | |
import android.app.AlertDialog; | |
import android.content.DialogInterface; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.text.TextUtils; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.Button; | |
import com.locationupdates.R; | |
import java.util.ArrayList; | |
/** | |
* Created by Bas on 11/12/2017 AD. | |
*/ | |
public class TEst extends AppCompatActivity { | |
ArrayList<Model> list = new ArrayList<>(); | |
Button start_updates_button; | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
start_updates_button = (Button) findViewById(R.id.start_updates_button); | |
list.add(new Model("B", "-1.0","P1")); | |
list.add(new Model("B", "0","P2")); | |
list.add(new Model("B", "-1.0","P3")); | |
list.add(new Model("B", "-1.0","P4")); | |
start_updates_button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
for (int i = 0; i < list.size(); i++) { | |
Log.e("getStatus",list.get(i).getStatus()); | |
Log.e("getStatus",list.get(i).getItemName()); | |
if (list.get(i).getStatus().equals("B")) { | |
if (list.get(i).getItemName().equals("-1.0")) { | |
final AlertDialog.Builder builder = new AlertDialog.Builder(TEst.this); | |
builder.setMessage(list.get(i).getItemName() + " : " + list.get(i).getCont()) | |
.setPositiveButton("ปิด", new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int id) { | |
dialog.dismiss(); | |
} | |
}); | |
builder.show(); | |
} else { | |
} | |
} | |
} | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment