Created
February 21, 2016 13:00
-
-
Save kundansviet/3533a5cca5f4176c42e1 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
import android.content.Intent; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
public class UserDetailList extends AppCompatActivity implements Listener { | |
RecyclerView recyclerView; | |
DbHelper dbHelper; | |
ListAdapter adapter; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_user_detail_list); | |
dbHelper = DbHelper.getInstance(getApplicationContext()); | |
recyclerView = (RecyclerView) findViewById(R.id.rv_contactlist); | |
adapter = new ListAdapter(this, dbHelper.getAllUser()); | |
recyclerView.setAdapter(adapter); | |
recyclerView.setLayoutManager(new LinearLayoutManager(this)); | |
} | |
@Override | |
public void onBackPressed() { | |
super.onBackPressed(); | |
Intent intent = new Intent(this, MainActivity.class); | |
startActivity(intent); | |
finish(); | |
} | |
@Override | |
public void nameToChnge(String name) { | |
dbHelper.deleteRow(name); | |
adapter = new ListAdapter(this, dbHelper.getAllUser()); | |
recyclerView.setAdapter(adapter); | |
recyclerView.setLayoutManager(new LinearLayoutManager(this)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment