NullPointerException when calling addToRequestQueue - android

I am working on post method with parameters. My app is not responding (find my code below). I am getting a NullPointerException when I am trying to add data into queue in void addToRequestQueue(Request<T> req, String tag). Could you, please, help me to identify the problem.
RegisterActivity
public class RegistrationActivity extends AppCompatActivity implements View.OnClickListener, VolleyTasksListener {
private Button btnRegister;
private EditText edtEmail;
private EditText edtConfirmEmail;
private EditText edtPassword;
private EditText edtconfirmPassword;
private EditText edtFullName;
private EditText edtContactNumber;
private TextView txtDOB;
private LinearLayout parentLayout;
private Toolbar toolbar;
private String udid;
private TextView txtErrEmail;
private TextView txtErrCEMAIL;
private TextView txtErrPassword;
private TextView txtErrCpassword;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
findViews();
initToolbar();
}
private void findViews() {
parentLayout = (LinearLayout) findViewById(R.id.lyt_parent);
btnRegister = (Button) findViewById(R.id.btn_register);
txtDOB = (TextView) findViewById(R.id.txt_dob);
txtErrPassword = (TextView) findViewById(R.id.txt_err_password);
txtErrCpassword = (TextView) findViewById(R.id.txt_err_c_password);
txtErrEmail = (TextView) findViewById(R.id.txt_err_email);
txtErrCEMAIL = (TextView) findViewById(R.id.txt_err_c_email);
edtEmail = (EditText) findViewById(R.id.edt_email);
edtConfirmEmail = (EditText) findViewById(R.id.edt_confirm_email);
edtPassword = (EditText) findViewById(R.id.edt_password);
edtconfirmPassword = (EditText) findViewById(R.id.edt_confirm_password);
edtFullName = (EditText) findViewById(R.id.edt_full_name);
edtContactNumber = (EditText) findViewById(R.id.edt_contact_number);
udid = Settings.Secure.getString(RegistrationActivity.this.getContentResolver(), Settings.Secure.ANDROID_ID);
TypefaceHelper.getInstance().setTypeface(parentLayout, Constant.FONT_OPENSANS_REGULAR);
TypefaceHelper.getInstance().setTypeface(btnRegister, Constant.FONT_OPENSANS_BOLD);
txtDOB.setOnClickListener(this);
btnRegister.setOnClickListener(this);
}
#Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_register:
getRegistrationService();
break;
case R.id.txt_dob:
ShowDatePicker();
break;
}
}
private void getRegistrationServiceValidation() {
{
String username = edtFullName.getText().toString().trim();
String confirmEmail = edtConfirmEmail.getText().toString();
String email = edtEmail.getText().toString();
String confirmPassword = edtconfirmPassword.getText().toString();
String mobile = edtContactNumber.getText().toString();
String password = edtPassword.getText().toString();
if (ValidationUtils.isValidEmail(email)) {
if (ValidationUtils.isValidEmail(email, confirmEmail)) {
if (ValidationUtils.isValidPassword(password)) {
if (ValidationUtils.isValidPassword(password, confirmPassword)) {
getRegistrationService();
} else {
txtErrCpassword.setVisibility(View.VISIBLE);
txtErrCpassword.setText("Password does not match");
}
}else{
txtErrPassword.setVisibility(View.VISIBLE);
txtErrPassword.setText("Password require more than 8 character");
}
}else {
txtErrCEMAIL.setVisibility(View.VISIBLE);
txtErrCEMAIL.setText("*Email does not match");
}
}else {
txtErrEmail.setVisibility(View.VISIBLE);
txtErrEmail.setText("*This Email has already been used");
}
}
}
private void getRegistrationService() {
if (ConnectionUtils.isConnectedNetwork(RegistrationActivity.this)) {
JSONObject jsonMainObject = new JSONObject();
try {
jsonMainObject.put("email_id", edtEmail.getText().toString());
jsonMainObject.put("password", edtPassword.getText().toString());
jsonMainObject.put("full_name", edtFullName.getText().toString());
jsonMainObject.put("contact_number", edtContactNumber.getText().toString());
jsonMainObject.put("dob", txtDOB.getText().toString());
jsonMainObject.put("gender", "Male");
VolleyTasks.makeVolleyPost(RegistrationActivity.this, Constant.REGISTRATION_URL, jsonMainObject, "Login");
} catch (JSONException e) {
e.printStackTrace();
}
} else {
DialogUtils.switchOnInternetDialog(RegistrationActivity.this, false);
}
}
private void getRegisterSucessAlert() {
Builder builder = new Builder(this);
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.alet_register_success, (ViewGroup) findViewById(R.id.lnt_root));
LinearLayout lytAlertParent = (LinearLayout) layout.findViewById(R.id.lnt_root);
TextView txttitle = (TextView) layout.findViewById(R.id.txt_register_title);
TypefaceHelper.getInstance().setTypeface(lytAlertParent, Constant.FONT_OPENSANS_REGULAR);
TypefaceHelper.getInstance().setTypeface(txttitle, Constant.FONT_OPENSANS_BOLD);
Button btnOk = (Button) layout.findViewById(R.id.btn_ok);
builder.setView(layout);
final android.app.AlertDialog alertDialog = builder.create();
alertDialog.setCanceledOnTouchOutside(true);
alertDialog.show();
btnOk.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
ActivityUtils.launchActivity(RegistrationActivity.this, HomeActivity.class, true);
}
});
}
private void ShowDatePicker() {
{
final AlertDialog.Builder builder = new AlertDialog.Builder(RegistrationActivity.this, R.style.AppCompatAlertDialogStyle);
final View view = View.inflate(RegistrationActivity.this, R.layout.picker_date, null);
builder.setView(view);
final DatePicker datePicker = (DatePicker) view.findViewById(R.id.date_picker);
builder.setPositiveButton("Set", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialogInterface, int i) {
Calendar calendar = new GregorianCalendar(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
String date = DateUtils.getSimpleDateFormat(Constant.DATE_TEMPLATE_CAB_BOOK, calendar.getTime());
txtDOB.setText(date);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
#Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
builder.show();
}
}
private void initToolbar() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("");
toolbar.setTitleTextColor(Color.WHITE);
setSupportActionBar(toolbar);
ImageView imgClose = (ImageView) findViewById(R.id.img_close);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
imgClose.setColorFilter(getResources().getColor(R.color.ft_blue, null));
} else {
imgClose.setColorFilter(getResources().getColor(R.color.ft_blue));
}
imgClose.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
ActivityUtils.launchActivity(RegistrationActivity.this, AuthenticationActivity.class, true);
}
});
}
#Override
public void onBackPressed() {
super.onBackPressed();
ActivityUtils.launchActivity(this, AuthenticationActivity.class, true);
}
#Override
public void handleError(Exception error) {
L.d("Error"+error);
}
#Override
public void handleResult(String method_name, JSONObject response) {
L.d ("response" + response);
if (response != null) {
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.serializeNulls();
Gson gson = gsonBuilder.create();
if (method_name.equals("Login")) {
AbstractRegister abstractRegister = gson.fromJson(response.toString(), AbstractRegister.class);
if (abstractRegister != null) {
if (abstractRegister.getResponse().equals("1")) {
getRegisterSucessAlert();
} else {
}
} else {
}
}
}
}}
Application
public class eTravelApplication extends Application {
private static eTravelApplication sInstance;
private RequestQueue mRequestQueue;
public static final String TAG = "VolleyPatterns";
#Override
public void onCreate() {
super.onCreate();
TypefaceHelper.initialize(this);
}
/**
* #return ApplicationController singleton instance
*/
public static synchronized eTravelApplication getInstance() {
return sInstance;
}
public RequestQueue getRequestQueue() {
// created when it is accessed for the first time
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue (getApplicationContext ());
}
return mRequestQueue;
}
/**
* Adds the specified request to the global queue, if tag is specified
* then it is used else Default TAG is used.
*
* #param req
* #param tag
*/
public <T> void addToRequestQueue(Request<T> req, String tag) {
// set the default tag if tag is empty
req.setTag(TextUtils.isEmpty (tag) ? TAG : tag);
VolleyLog.d ("Adding request to queue: %s", req.getUrl ());
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
// set the default tag if tag is empty
req.setTag(TAG);
getRequestQueue().add(req);
}
/**
* Cancels all pending requests by the specified TAG, it is important
* to specify a TAG so that the pending/ongoing requests can be cancelled.
*
* #param tag
*/
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
#Override
public void onTerminate() {
TypefaceHelper.destroy();
super.onTerminate();
}}

Related

Showing specific button to current user in Android

My app has a post layout which have an edit button and the send button. All i want to do is to show only edit button if current user is viewing his/her post and not the send button. Just like a stackoverflow post, you can't edit other's post and can't send a message to yourself. I have tried boolean methods but still no solution. Thanks.
Activity that have showButtonsForCurrentUser() method ;
public class ViewPostActivity extends AppCompatActivity {
private static final String TAG = "ViewPostActivity";
//widgets
private TextView mTitle, mDescription, mPrice, mLocation;
//vars
private String mPostId;
private String userId;
private Post mPost;
private PostImages mPostImages;
private ViewPager viewPager;
private ImageView editPostIcon;
private WormDotsIndicator wormDotsIndicator;
public ViewAdapter viewAdapter;
public DatabaseReference reference;
public FirebaseUser currentUser;
public ArrayList<String> IMAGES = new ArrayList<>();
public ArrayList<Uri> mImageUris = new ArrayList<>();
private SquareImageView postImageView;
private User user;
//Dialog and Sheet vars
private Dialog deleteDialog;
private Button deleteBtnDialog;
private Button deleteBtnSheet;
private Button updateBtn;
private Button sendBtn;
private TextView titleTv, messageTv;
private ImageView closeIcon;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_post);
mPostId = getIntent().getStringExtra(getString(R.string.arg_post_id));
mTitle = (TextView) findViewById(R.id.post_title);
mDescription = (TextView) findViewById(R.id.post_description);
mPrice = (TextView) findViewById(R.id.post_price);
mLocation = (TextView) findViewById(R.id.post_location);
postImageView = findViewById(R.id.post_image);
sendBtn = findViewById(R.id.send_msg);
viewPager = findViewById(R.id.view_pager_images);
editPostIcon = findViewById(R.id.edit_post_btn);
wormDotsIndicator = findViewById(R.id.dotsindicator);
editPostIcon.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
showBottomSheetDialog();
}
});
getPostInfo();
showButtonsForCurrentUser();
////MyPosts Layout/////
deleteBtnDialog = findViewById(R.id.dialog_btn);
deleteDialog = new Dialog(this);
////MyPosts Layout/////
sendBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent intent = new Intent(ViewPostActivity.this, MessageActivity.class);
intent.putExtra("userId", userId);
startActivity(intent);
}
});
}
public void showButtonsForCurrentUser(){
currentUser = FirebaseAuth.getInstance().getCurrentUser();
//sendBtn and editPostIcon are set to GONE.
if (currentUser.equals(userId)){
sendBtn.setVisibility(View.VISIBLE);
}else{
editPostIcon.setVisibility(View.VISIBLE);
}
}
private void getPostInfo(){
Log.d(TAG, "getPostInfo: getting the post information.");
reference = FirebaseDatabase.getInstance().getReference();
Query query = reference.child(getString(R.string.node_posts))
.orderByKey()
.equalTo(mPostId);
query.addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
DataSnapshot singleSnapshot = dataSnapshot.getChildren().iterator().next();
if(singleSnapshot != null){
mPost = singleSnapshot.getValue(Post.class);
Log.d(TAG, "onDataChange: found the post: " + mPost.getTitle());
mTitle.setText(mPost.getTitle());
mDescription.setText(mPost.getDescription());
String price = "FREE";
if(mPost.getPrice() != null){
price = "$" + mPost.getPrice();
}
mPrice.setText(price);
String location = mPost.getCity();
mLocation.setText(location);
userId = mPost.getUser_id();
if (mPost.getImage() != null){
wormDotsIndicator.setVisibility(View.INVISIBLE);
postImageView.setVisibility(View.VISIBLE);
Picasso.get().load(mPost.getImage()).into(postImageView);
}else {
IMAGES = mPost.getPostImages();
for (int i = 0; i <IMAGES.size(); i++){
Uri myUri = Uri.parse(IMAGES.get(i));
mImageUris.add(myUri);
}
viewAdapter = new ViewAdapter(getApplication(), IMAGES);
viewPager.setAdapter(viewAdapter);
wormDotsIndicator.setViewPager(viewPager);
}
}
}
#Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void showBottomSheetDialog() {
final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(ViewPostActivity.this, R.style.BottomSheetDialogTheme);
LinearLayout linearLayout = findViewById(R.id.bottom_sheet_update_container);
View bottomSheetView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.bottom_sheet_update, linearLayout);
updateBtn = bottomSheetView.findViewById(R.id.update_btnn);
deleteBtnSheet = bottomSheetView.findViewById(R.id.delete_btnn);
bottomSheetDialog.setContentView(bottomSheetView);
bottomSheetDialog.show();
updateBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
Intent updateActivityIntent = new Intent(ViewPostActivity.this, UpdateActivity.class);
if (IMAGES != null){
updateActivityIntent.putStringArrayListExtra("IMAGES", IMAGES);
updateActivityIntent.putParcelableArrayListExtra("IMAGEURIS", mImageUris);
}else {
String singlePhotoUrl = mPost.getImage();
updateActivityIntent.putExtra("Single Photo url", singlePhotoUrl);
}
updateActivityIntent.putExtra("Başlık", mTitle.getText());
updateActivityIntent.putExtra("Açıklama", mDescription.getText());
updateActivityIntent.putExtra("Fiyat", mPrice.getText());
updateActivityIntent.putExtra("mPostId", mPostId);
startActivity(updateActivityIntent);
bottomSheetDialog.dismiss();
}
});
deleteBtnSheet.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
showDeleteDialog();
}
});
}
public void showDeleteDialog(){
deleteDialog.setContentView(R.layout.positive_dialog);
closeIcon = deleteDialog.findViewById(R.id.close_dialog);
deleteBtnDialog = deleteDialog.findViewById(R.id.dialog_btn);
titleTv = deleteDialog.findViewById(R.id.titleTv);
messageTv = deleteDialog.findViewById(R.id.message_dialog);
closeIcon.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
deleteDialog.dismiss();
}
});
deleteDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
deleteDialog.show();
deleteBtnDialog.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
deletePost(mPostId);
finish();
overridePendingTransition( 0, 0);
startActivity(getIntent());
overridePendingTransition( 0, 0);
deleteDialog.dismiss();
}
});
}
private void deletePost(String deletePostId){
Bundle args = new Bundle();
args.putString(getString(R.string.arg_post_id), deletePostId);
Query deleteQuery = reference.child("posts").orderByChild("post_id").equalTo(deletePostId);
deleteQuery.addListenerForSingleValueEvent(new ValueEventListener() {
#Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot delData: dataSnapshot.getChildren()){
delData.getRef().removeValue();
Intent backIntent = new Intent(ViewPostActivity.this, SearchActivity.class);
startActivity(backIntent);
}
Toast.makeText(ViewPostActivity.this,"Data Deleted",Toast.LENGTH_LONG).show();
}
#Override
public void onCancelled(DatabaseError databaseError) {
Toast.makeText(ViewPostActivity.this,databaseError.getMessage(),Toast.LENGTH_LONG).show();
}
});
}
private void status(String status){
currentUser = FirebaseAuth.getInstance().getCurrentUser();
reference = FirebaseDatabase.getInstance().getReference("users").child(currentUser.getUid());
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("status", status);
reference.updateChildren(hashMap);
}
#Override
protected void onResume() {
super.onResume();
status("online");
}
#Override
protected void onPause() {
super.onPause();
status("offline");
}
}
what are the values for mPostId?
I would log the userID and currentuser values thats being retrieved, to check if there is no issue your query. The boolean part should work

LiveData observer triggered after reloading fragment

My MainAcivity hosts 2 fragments, login and register. I have a LiveData observer on LoginFragment that observes user login live data, after which if user is authenticated MainMenuActivity intent will start. On main menu there's logout button that would start MainActivity and load LoginFragment.
But here's the problem, the observer on LoginFragment triggered immediately after loading the fragment, which straight up start MainMenuActivity intent again.
My LoginFragment:
public class LoginFragment extends Fragment {
public static LoginFragment newInstance(){
return new LoginFragment();
}
private LoginViewModel mLoginViewModel;
private LiveData<UserModelJSONPlaceholder> mUserModelLiveData;
private static final String TAG = "FragLogin";
private Button mBtnLogin;
private EditText mTxtUsername, mTxtPass;
private TextView mTxtRegister;
private CheckBox mCheckBoxRemember;
private TextView mTxtInvalid;
private Callbacks mCallbacks = null;
private ProgressBar mProgressBar;
private UserApiInterface mAPIInterface;
private SharedPreferences mSharedPreferences;
private SharedPreferences.Editor mPreferencesEditor;
#Nullable
#Override
public View onCreateView(#NonNull LayoutInflater inflater, #Nullable ViewGroup container, #Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_login,container,false);
mBtnLogin = view.findViewById(R.id.btnLogin_login);
mTxtUsername = view.findViewById(R.id.txtUsername);
mTxtPass = view.findViewById(R.id.txtPass);
mCheckBoxRemember = view.findViewById(R.id.checkBoxRememberMe);
mTxtRegister = view.findViewById(R.id.txtRegister_login);
mProgressBar = view.findViewById(R.id.progressBar);
mTxtInvalid = view.findViewById(R.id.txtInvalid);
mProgressBar.setVisibility(View.GONE);
mTxtInvalid.setVisibility(View.GONE);
mAPIInterface = APIClient.getClient().create(UserApiInterface.class);
mSharedPreferences = getContext().getSharedPreferences("login",Context.MODE_PRIVATE);
mPreferencesEditor = mSharedPreferences.edit();
setListener();
return view;
}
#Override
public void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLoginViewModel = new ViewModelProvider(this).get(LoginViewModel.class);
mUserModelLiveData = mLoginViewModel.getUserModelLiveData();
//observer would be triggered right after loading fragment after logout
mUserModelLiveData.observe(this, new Observer<UserModelJSONPlaceholder>() {
#Override
public void onChanged(UserModelJSONPlaceholder userModel) {
Log.d(TAG, "onChanged: Observer: "+userModel.getResponse());
mProgressBar.setVisibility(View.GONE);
String loginAuth = userModel.getResponse();
if(loginAuth.equals("OK")){
mPreferencesEditor.putString("name",userModel.getUserModel().getName());
mCallbacks.login_goMainMenu(userModel.getUserModel().getName());
}else{
mTxtInvalid.setVisibility(View.VISIBLE);
}
}
});
}
private void doLogin(){
mProgressBar.setVisibility(View.VISIBLE);
final String username = mTxtUsername.getText().toString().trim();
final String password = mTxtPass.getText().toString().trim();
mLoginViewModel.authLogin(username,password);
}
#Override
public void onAttach(Context context) {
super.onAttach(context);
mCallbacks = (Callbacks) context;
}
private void setListener(){
mBtnLogin.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
doLogin();
}
});
mTxtRegister.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
mCallbacks.login_goRegister();
}
});
mCheckBoxRemember.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
#Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(buttonView.isChecked()){
mPreferencesEditor.putBoolean("rememberMe", true).apply();
Log.d(TAG, "onCheckedChanged: Checked");
}else{
mPreferencesEditor.putBoolean("rememberMe", false).apply();
Log.d(TAG, "onCheckedChanged: Unchecked");
}
}
});
}
public interface Callbacks{
void login_goMainMenu(String name);
void login_goRegister();
}
}
My MainMenuActivity:
public class MainMenuActivity extends AppCompatActivity {
private static final String ARG_NAME = "arg_name";
private Button mBtnEnterQ,mBtnCreateQ;
private TextView mTxtName;
private Toolbar mToolbar;
private SharedPreferences mSharedPreferences;
private SharedPreferences.Editor mEditor;
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
mBtnEnterQ = findViewById(R.id.btnEnterQ);
mBtnCreateQ = findViewById(R.id.btnCreateQ);
mTxtName = findViewById(R.id.txtUsername);
mToolbar = findViewById(R.id.toolbar);
mSharedPreferences = getSharedPreferences("login",MODE_PRIVATE);
mEditor = mSharedPreferences.edit();
setSupportActionBar(mToolbar);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.toolbar_menu,menu);
return true;
}
#Override
public boolean onOptionsItemSelected(#NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.itemLogout:
doLogout();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void doLogout(){
mEditor.remove("rememberMe");
mEditor.apply();
Intent i = new Intent(this, MainActivity.class);
startActivity(i);
finish();
}
}
and here's my ViewModel and Repo for LoginFragment:
public class LoginViewModel extends ViewModel {
private static final String TAG = "LoginVM";
private UserRepository mUserRepository;
LiveData<UserModelJSONPlaceholder> mUserModelLiveData;
public LoginViewModel() {
mUserRepository = UserRepository.getInstance();
}
public void authLogin(String username, String password){
mUserRepository.authLogin(username,password);
}
public LiveData<UserModelJSONPlaceholder> getUserModelLiveData() {
return mUserRepository.getUserModelLiveData();
}
}
public class UserRepository {
private static UserRepository instance;
private static final String TAG = "RepoUser";
private UserApiInterface mUserApiInterface;
MutableLiveData<UserModelJSONPlaceholder> userModelLiveData;
public static UserRepository getInstance(){
if(instance==null){
instance=new UserRepository();
}
return instance;
}
private UserRepository(){
mUserApiInterface = APIClient.getClient().create(UserApiInterface.class);
Log.d(TAG, "UserRepository: repoInit");
}
public void authLogin(String username, String password){
Log.d(TAG, "authLogin: REQUEST INIT");
Log.d(TAG, "authLogin: SERVER: "+ CONFIG.SERVER);
mUserApiInterface.getUser(username,password).enqueue(new Callback<UserModelJSONPlaceholder>() {
#Override
public void onResponse(Call<UserModelJSONPlaceholder> call, Response<UserModelJSONPlaceholder> response) {
if(response.isSuccessful()){
UserModelJSONPlaceholder r = response.body();
userModelLiveData.postValue(response.body());
}else{
Log.d(TAG, "onResponse: FAILED. "+response.errorBody());
}
}
#Override
public void onFailure(Call<UserModelJSONPlaceholder> call, Throwable t) {
Log.d(TAG, "onFailure: "+t.getMessage());
}
});
}
public LiveData<UserModelJSONPlaceholder> getUserModelLiveData() {
if(userModelLiveData == null)
userModelLiveData = new MutableLiveData<>();
return userModelLiveData;
}
}
Your problems is you make UserRepository is Singleton instance and always keep value of userModelLiveData easy way to fix it change method to this
public LiveData<UserModelJSONPlaceholder> getUserModelLiveData() {
userModelLiveData = new MutableLiveData<>();
return userModelLiveData;
}

How to get the data from server and upload data to server using Json

How to get the data from server and upload data to server using JSON?
please tell me.
This is QRActivity------------------------------------------------
final View.OnClickListener listener = new View.OnClickListener() {
#Override
public
void onClick(View v) {
btnSearch.setClickable(true);
// Server call with record_id
//DistributionDetails detDis <-- response json object from server call
QrActivityViewDetails detDis = new
QrActivityViewDetails(1002,"NORORG147530","No2,abcd Road , Colombo 03","0112233456");
Intent myIntent = new Intent(QrActivity.this, DistributionDetails.class);
myIntent.putExtra("QrActivityViewDetails", detDis);
startActivity(myIntent);
}
};
This is QrActivityViewDetails Class file
public class QrActivityViewDetails implements Serializable {
#SerializedName("DistributionID")
private int DistributionID;
#SerializedName("full_name")
private String full_name;
#SerializedName("full_address")
private String full_address;
#SerializedName("contact")
private String contact;
public QrActivityViewDetails(int DistributionID, String full_name, String full_address, String contact_number)
{
this.DistributionID = DistributionID;
this.full_name = full_name;
this.full_address = full_address;
this.contact = contact_number;
}
public
int getRecord_id() {
return DistributionID;
}
public
void setRecord_id(int record_id) {
this.DistributionID = record_id;
}
public
String getFull_name() {
return full_name;
}
public
void setFull_name(String full_name) {
this.full_name = full_name;
}
public
String getFull_address() {
return full_address;
}
public
void setFull_address(String full_address) {
this.full_address = full_address;
}
public
String getContact() {
return contact;
}
public
void setContact(String contact) {
this.contact = contact;
}
}
This is View Data Activity called DistributionDetails---------------
public class DistributionDetails extends AppCompatActivity {
private QrActivityViewDetails detQRV;
TextView ID ,Address ,name,contact;
Button btnDIR;
#Override
protected
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_distribution_details);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
ID = (TextView) findViewById(R.id.lblID);
Address = (TextView) findViewById(R.id.lblAddress);
name = (TextView) findViewById(R.id.lblUname);
contact = (TextView) findViewById(R.id.lblTelenum);
btnDIR = (Button) findViewById(R.id.btnDelivered);
IntendFill();
btnDIR.setOnClickListener(new View.OnClickListener() {
#Override
public
void onClick(View v) {
Intent intent = new Intent(DistributionDetails.this, FinalActivity.class);
startActivity(intent);
}
});
}
public void IntendFill() {
Intent intent = getIntent();
if (intent.hasExtra("QrActivityViewDetails")) {
detQRV = (QrActivityViewDetails) intent.getSerializableExtra("QrActivityViewDetails");
ID.setText(String.valueOf(detQRV.getRecord_id()));
Address.setText(String.valueOf(detQRV.getFull_address()));
name.setText(String.valueOf(detQRV.getFull_name()));
contact.setText(String.valueOf(detQRV.getContact()));
}
}
}

Cannot click on interstitial ad in WebView fragment

I have made an AdvanceWebView Application.
In that I have made a function to show interstitialAd in "fragmentActivity", that means whenever I download something from that webview that Ad will show up but it isn't clickable.
I think my ad is showing behind that fragment or something like that or maybe some other issue.
And when Vedio Ads are showen, the countdown of that ad also doesn't woprking.
I can see the Ad but it isn't clickable and if I click on any part of Ad, Logcat
is showing this => "I/HwSecImmHelper: mSecurityInputMethodService is null"
Here it is some part of my code:
WebfragmentActivy:
public class WebFragment extends Fragment implements AdvancedWebView.Listener, SwipeRefreshLayout.OnRefreshListener{
//Layouts
public FrameLayout rl;
public AdvancedWebView browser;
public SwipeRefreshLayout swipeLayout;
public ProgressBar progressBar;
//WebView Clients
public WebToAppChromeClient chromeClient;
public WebToAppWebClient webClient;
//WebView Session
public String mainUrl = null;
static String URL = "url";
public int firstLoad = 0;
//Keep track of the interstitials we show
private int interstitialCount = -1;
public WebFragment() {
// Required empty public constructor
}
public static WebFragment newInstance(String url) {
WebFragment fragment = new WebFragment();
Bundle args = new Bundle();
args.putString(URL, url);
fragment.setArguments(args);
return fragment;
}
public void setBaseUrl(String url){
this.mainUrl = url;
browser.loadUrl(mainUrl);
}
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null && mainUrl == null) {
mainUrl = getArguments().getString(URL);
firstLoad = 0;
}
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rl = (FrameLayout) inflater.inflate(R.layout.fragment_observable_web_view, container,
false);
progressBar = (ProgressBar) rl.findViewById(R.id.progressbar);
browser = (AdvancedWebView) rl.findViewById(R.id.scrollable);
swipeLayout = (SwipeRefreshLayout) rl.findViewById(R.id.swipe_container);
return rl;
}
#Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (Config.PULL_TO_REFRESH)
swipeLayout.setOnRefreshListener(this);
else
swipeLayout.setEnabled(false);
// Setting the webview listeners
browser.setListener(this, this);
// set javascript and zoom and some other settings
browser.requestFocus();
browser.getSettings().setJavaScriptEnabled(true);
browser.getSettings().setBuiltInZoomControls(false);
browser.getSettings().setAppCacheEnabled(true);
browser.getSettings().setDatabaseEnabled(true);
browser.getSettings().setDomStorageEnabled(true);
// Below required for geolocation
browser.setGeolocationEnabled(true);
// 3RD party plugins (on older devices)
browser.getSettings().setPluginState(PluginState.ON);
if (Config.MULTI_WINDOWS) {
browser.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
browser.getSettings().setSupportMultipleWindows(true);
}
webClient = new WebToAppWebClient(getActivity(), browser);
browser.setWebViewClient(webClient);
chromeClient = new WebToAppChromeClient(getActivity(), rl, browser, swipeLayout, progressBar);
browser.setWebChromeClient(chromeClient);
// load url (if connection available
if (webClient.hasConnectivity(mainUrl, true)) {
String pushurl = ((App) getActivity().getApplication()).getPushUrl();
if (pushurl != null){
browser.loadUrl(pushurl);
} else {
browser.loadUrl(mainUrl);
}
}
}
#Override
public void onRefresh() {
browser.reload();
}
#SuppressLint("NewApi")
#Override
public void onPause() {
super.onPause();
browser.onPause();
}
#Override
public void onDestroy() {
super.onDestroy();
browser.onDestroy();
}
#SuppressLint("NewApi")
#Override
public void onResume() {
super.onResume();
browser.onResume();
}
#SuppressLint("NewApi")
#Override
public void onDownloadRequested(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
if (!hasPermissionToDownload(getActivity())) return;
String filename = null;
try {
filename = new GetFileInfo().execute(url).get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
if (filename == null) {
String fileExtenstion = MimeTypeMap.getFileExtensionFromUrl(url);
filename = URLUtil.guessFileName(url, null, fileExtenstion);
}
if (AdvancedWebView.handleDownload(getActivity(), url, filename)) {
Toast.makeText(getActivity(), getResources().getString(R.string.download_done), Toast.LENGTH_SHORT).show();
onDownloadInterstitialAd();
}
else {
Toast.makeText(getActivity(), getResources().getString(R.string.download_fail), Toast.LENGTH_SHORT).show();
}
}
private static boolean hasPermissionToDownload(final Activity context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE)
== PackageManager.PERMISSION_GRANTED )
return true;
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.download_permission_explaination);
builder.setPositiveButton(R.string.common_permission_grant, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// Fire off an async request to actually get the permission
// This will show the standard permission request dialog UI
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
context.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
}
});
AlertDialog dialog = builder.create();
dialog.show();
return false;
}
#Override
public void onPageStarted(String url, Bitmap favicon) {
if (firstLoad == 0 && MainActivity.getCollapsingActionBar()){
((MainActivity) getActivity()).showToolbar(this);
firstLoad = 1;
} else if (firstLoad == 0){
firstLoad = 1;
}
}
/**
* Show an interstitial ad
*/
private void onDownloadInterstitialAd(){
final InterstitialAd mInterstitialAd = new InterstitialAd(getActivity());
mInterstitialAd.setAdUnitId(getResources().getString(R.string.ad_interstitial_id));
AdRequest adRequestInter = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
mInterstitialAd.setAdListener(new AdListener() {
#Override
public void onAdLoaded() {
mInterstitialAd.show();
}
});
mInterstitialAd.loadAd(adRequestInter);
}
#Override
public void onPageFinished(String url) {
//showInterstitial();
}
#Override
public void onPageError(int errorCode, String description, String failingUrl) {
// TODO Auto-generated method stub
}
#Override
public void onExternalPageRequest(String url) {
// TODO Auto-generated method stub
}
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
browser.onActivityResult(requestCode, resultCode, data);
}
}
And this is my Main Activity:
public class MainActivity extends AppCompatActivity implements DrawerFragment.DrawerFragmentListener{
//Views
public Toolbar mToolbar;
public View mHeaderView;
public TabLayout mSlidingTabLayout;
public SwipeableViewPager mViewPager;
//App Navigation Structure
private NavigationAdapter mAdapter;
private DrawerFragment drawerFragment;
private WebFragment CurrentAnimatingFragment = null;
private int CurrentAnimation = 0;
//Identify toolbar state
private static int NO = 0;
private static int HIDING = 1;
private static int SHOWING = 2;
//Keep track of the interstitials we show
private int interstitialCount = 0;
SharedPreferences prefs;
public FirebaseAuth authtt;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
authtt = FirebaseAuth.getInstance();
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mHeaderView = (View) findViewById(R.id.header_container);
mSlidingTabLayout = (TabLayout) findViewById(R.id.tabs);
mViewPager = (SwipeableViewPager) findViewById(R.id.pager);
setSupportActionBar(mToolbar);
mAdapter = new NavigationAdapter(getSupportFragmentManager(), this);
final Intent intent = getIntent();
final String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) {
String data = intent.getDataString();
((App) getApplication()).setPushUrl(data);
}
hasPermissionToDo(this, Config.PERMISSIONS_REQUIRED);
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mViewPager.getLayoutParams();
if ((Config.HIDE_ACTIONBAR && getHideTabs()) || ((Config.HIDE_ACTIONBAR || getHideTabs()) && getCollapsingActionBar())){
lp.topMargin = 0;
} else if ((Config.HIDE_ACTIONBAR || getHideTabs()) || (!Config.HIDE_ACTIONBAR && !getHideTabs() && getCollapsingActionBar())){
lp.topMargin = getActionBarHeight();
} else if (!Config.HIDE_ACTIONBAR && !getHideTabs()){
lp.topMargin = getActionBarHeight() * 2;
}
if (Config.USE_DRAWER) {
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setLogo(R.mipmap.ic_launcher);
getSupportActionBar().setDisplayUseLogoEnabled(true);
drawerFragment = (DrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);
drawerFragment.setUp(R.id.fragment_navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
drawerFragment.setDrawerListener(this);
} else {
((DrawerLayout) findViewById(R.id.drawer_layout)).setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
mViewPager.setLayoutParams(lp);
mViewPager.setAdapter(mAdapter);
mViewPager.setOffscreenPageLimit(mViewPager.getAdapter().getCount() - 1);
mSlidingTabLayout.setSelectedTabIndicatorColor(getResources().getColor(R.color.accent));
mSlidingTabLayout.setupWithViewPager(mViewPager);
mSlidingTabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
#Override
public void onTabSelected(TabLayout.Tab tab) {
if (getCollapsingActionBar()) {
showToolbar(getFragment());
}
mViewPager.setCurrentItem(tab.getPosition());
showInterstitial();
}
#Override
public void onTabUnselected(TabLayout.Tab tab) {
}
#Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
for (int i = 0; i < mSlidingTabLayout.getTabCount(); i++) {
if (Config.ICONS.length > i && Config.ICONS[i] != 0) {
mSlidingTabLayout.getTabAt(i).setIcon(Config.ICONS[i]);
}
}
// admob
if (!getResources().getString(R.string.ad_banner_id).equals("")) {
// Look up the AdView as a resource and load a request.
AdView adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
} else {
AdView adView = (AdView) findViewById(R.id.adView);
adView.setVisibility(View.GONE);
}
// application rating
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle(getString(R.string.rate_title))
.setMessage(String.format(getString(R.string.rate_message), getString(R.string.app_name)))
.setPositiveButton(getString(R.string.rate_yes), null)
.setNegativeButton(getString(R.string.rate_never), null)
.setNeutralButton(getString(R.string.rate_later), null);
new AppRate(this)
.setShowIfAppHasCrashed(false)
.setMinDaysUntilPrompt(2)
.setMinLaunchesUntilPrompt(2)
.setCustomDialog(builder)
.init();
// showing the splash screen
if (Config.SPLASH) {
findViewById(R.id.imageLoading1).setVisibility(View.VISIBLE);
//getFragment().browser.setVisibility(View.GONE);
}
}
// using the back button of the device
#Override
public void onBackPressed() {
View customView = null;
WebChromeClient.CustomViewCallback customViewCallback = null;
if (getFragment().chromeClient != null) {
customView = getFragment().chromeClient.getCustomView();
customViewCallback = getFragment().chromeClient.getCustomViewCallback();
}
if ((customView == null)
&& getFragment().browser.canGoBack()) {
getFragment().browser.goBack();
} else if (customView != null
&& customViewCallback != null) {
customViewCallback.onCustomViewHidden();
} else {
super.onBackPressed();
}
}
#Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
}
#Override
protected void onPause() {
super.onPause();
}
#Override
protected void onResume() {
super.onResume();
}
public void setTitle(String title) {
if (mAdapter != null && mAdapter.getCount() == 1 && !Config.USE_DRAWER && !Config.STATIC_TOOLBAR_TITLE)
getSupportActionBar().setTitle(title);
}
public WebFragment getFragment(){
return (WebFragment) mAdapter.getCurrentFragment();
}
boolean getHideTabs(){
if (mAdapter.getCount() == 1 || Config.USE_DRAWER){
return true;
} else {
return Config.HIDE_TABS;
}
}
#Override
public boolean onDrawerItemSelected(View view, int position) {
String url = Config.URLS[position];
if (WebToAppWebClient.urlShouldOpenExternally(url)){
try {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} catch(ActivityNotFoundException e) {
if (url.startsWith("intent://")) {
view.getContext().startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(url.replace("intent://", "http://"))));
} else {
Toast.makeText(this, getResources().getString(R.string.no_app_message), Toast.LENGTH_LONG).show();
}
}
return false;
} else {
getFragment().browser.loadUrl("about:blank");
getFragment().setBaseUrl(Config.URLS[position]);
showInterstitial();
return true;
}
}
private static boolean hasPermissionToDo(final Activity context, final String[] permissions) {
boolean oneDenied = false;
for (String permission : permissions) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
ContextCompat.checkSelfPermission(context, permission)
!= PackageManager.PERMISSION_GRANTED)
oneDenied = true;
}
if (!oneDenied) return true;
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(context);
builder.setMessage(R.string.common_permission_explaination);
builder.setPositiveButton(R.string.common_permission_grant, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// Fire off an async request to actually get the permission
// This will show the standard permission request dialog UI
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
context.requestPermissions(permissions,1);
}
});
android.support.v7.app.AlertDialog dialog = builder.create();
dialog.setCanceledOnTouchOutside(false);
dialog.show();
return false;
}
}

Android DialogFragment and EditText not restoring state

Please help me. I don't know why, but after screen rotation EditText is empty. I use setRetainInstance(true), but it doesn't help for me. Please tell me what is the right way to save dialog's state and EditText's state with selection and text
My code:
public class InputTextDialog extends DialogFragment implements OnClickListener {
static final String DIALOG_TAG = "InputTextDialog";
static EditText input;
String initialText;
InputTextDialogListener inputTextDialogListener = null;
public interface InputTextDialogListener {
void onChangeText(String text);
}
public void setInputTextDialogListener(InputTextDialogListener listener) {
inputTextDialogListener = listener;
}
public void setInitialText(String text) {
initialText = text;
}
#Override
public void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
#Override
public void onDestroyView() {
if (getDialog() != null && getRetainInstance())
getDialog().setDismissMessage(null);
super.onDestroyView();
}
#Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
input = new EditText(getActivity());
input.setHint("Enter your text");
if (initialText != null) {
input.setText(initialText);
} else {
input.setText("");
}
AlertDialog.Builder adb = new AlertDialog.Builder(getActivity())
.setTitle("Enter your text").setPositiveButton("Apply", this)
.setNegativeButton("Cancel", this).setView(input);
return adb.create();
}
#Override
public void onClick(DialogInterface dialog, int which) {
if (which == Dialog.BUTTON_POSITIVE && inputTextDialogListener != null) {
inputTextDialogListener.onChangeText(input.getText().toString());
}
}
}
Show dialog in activity:
button.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
InputTextDialog inputDialog = new InputTextDialog();
inputDialog.setInitialText(initialText);
inputDialog.setInputTextDialogListener(new InputTextDialogListener() {
#Override
public void onChangeText(String text) {
resultText = text;
}
});
inputDialog.show(getSupportFragmentManager(), InputTextDialog.DIALOG_TAG);
}
});
Thanks I solved this by:
package com.xfakehopex.lovelywidget.Dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.EditText;
public class InputTextDialog extends DialogFragment implements OnClickListener {
public static final String DIALOG_TAG = "InputTextDialog";
private static final String DIALOG_TITLE_BUNDLE= "dialogTitle";
private static final String DIALOG_TEXT_BUNDLE= "dialogText";
private static final String DIALOG_TEXT_SELECTION_START_BUNDLE = "dialogTextSelectionStart";
private static final String DIALOG_TEXT_SELECTION_END_BUNDLE = "dialogTextSelectionEnd";
private EditText input;
private String initialText;
private String title;
InputTextDialogListener inputTextDialogListener = null;
public interface InputTextDialogListener {
void onChangeText(String text);
}
public void setInputTextDialogListener(InputTextDialogListener listener) {
inputTextDialogListener = listener;
}
public void setInitialText(String text) {
initialText = text;
}
#Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
input = new EditText(getActivity());
input.setHint("Введите текст");
if (savedInstanceState != null) {
String text = savedInstanceState.getString(DIALOG_TEXT_BUNDLE);
title = savedInstanceState.getString(DIALOG_TITLE_BUNDLE);
int selectionStart = savedInstanceState.getInt(DIALOG_TEXT_SELECTION_START_BUNDLE);
int selectionEnd = savedInstanceState.getInt(DIALOG_TEXT_SELECTION_END_BUNDLE);
input.setText(text);
input.setSelection(selectionStart, selectionEnd);
}
else
{
if (initialText != null) {
input.setText(initialText);
} else {
input.setText("");
}
}
AlertDialog.Builder adb = new AlertDialog.Builder(getActivity())
.setTitle(title).setPositiveButton("Apply", this)
.setNegativeButton("Cancel", this).setView(input);
return adb.create();
}
#Override
public void onSaveInstanceState(Bundle saved) {
super.onSaveInstanceState(saved);
saved.putString(DIALOG_TEXT_BUNDLE, input.getText().toString());
saved.putString(DIALOG_TITLE_BUNDLE, title);
saved.putInt(DIALOG_TEXT_SELECTION_START_BUNDLE, input.getSelectionStart());
saved.putInt(DIALOG_TEXT_SELECTION_END_BUNDLE, input.getSelectionEnd());
}
#Override
public void onClick(DialogInterface dialog, int which) {
if (which == Dialog.BUTTON_POSITIVE && inputTextDialogListener != null) {
inputTextDialogListener.onChangeText(input.getText().toString());
}
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

Categories

Resources