-
Notifications
You must be signed in to change notification settings - Fork 1
/
MainActivity2.java
34 lines (31 loc) · 1.22 KB
/
MainActivity2.java
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
package com.example.msi.myapplication;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Toast;
import javax.sql.DataSource;
public class MainActivity2 extends AppCompatActivity
{
private RecyclerView mRecyclerView;
private MainAdapter mAdapter;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
mRecyclerView = (RecyclerView) findViewById(R.id.main_recyclerview);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new MainAdapter(MainActivity.generateData(MainActivity.t));
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new MainAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, String data) {
Toast.makeText(MainActivity2.this, data, Toast.LENGTH_SHORT).show();
}
});
}
}