-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivitymain
36 lines (29 loc) · 1.2 KB
/
activitymain
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.example.mdmamunhossain.myapplication;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ListView ProfileListView;
ArrayList<Profile>profiles;
profileAdapter profileadapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ProfileListView = (ListView) findViewById(R.id.profileListView);
final Profile profile = new Profile();
profiles = profile.getAllProfile();
profileadapter = new profileAdapter(this,profiles);
ProfileListView.setAdapter(profileadapter);
ProfileListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(),profiles.get(position).getProfileName(),Toast.LENGTH_SHORT).show();
}
});
}
}