Repository navigation
Expand file tree
/
Copy pathTopSectionFragment.java
More file actions
60 lines (47 loc) · 1.81 KB
/
Copy pathTopSectionFragment.java
File metadata and controls
60 lines (47 loc) · 1.81 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package aybars.arslan.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.app.Activity;
import android.widget.Button;
import android.widget.EditText;
public class TopSectionFragment extends Fragment {
private static EditText etTopTextInput;
private static EditText etBottomTextInput;
TopSectionListener activityCommander;
public interface TopSectionListener{
public void createClick(String top, String bottom);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try{
activityCommander = (TopSectionListener) activity;
}catch (ClassCastException e){
throw new ClassCastException(activity.toString());
}
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.top_section_fragment, container, false);
etTopTextInput = (EditText)view. findViewById(R.id.etTopTextInput);
etBottomTextInput = (EditText)view.findViewById(R.id.etBottomTextInput);
final Button button = (Button)view.findViewById(R.id.btn);
button.setOnClickListener(
new View.OnClickListener(){
@Override
public void onClick(View v) {
buttonClicked(v);
}
}
);
return view;
}
//Calls this when button clicked
public void buttonClicked(View view){
activityCommander.createClick(etTopTextInput.getText().toString(), etBottomTextInput.getText().toString());
}
}