forked from rohitcoderCdefense/vulnCodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCWE-117.java
57 lines (46 loc) · 1.65 KB
/
CWE-117.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.example.ultranote.activities;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.example.ultranote.R;
import java.util.List;
import database.NotesDatabase;
import entities.Note;
public class CreateNote extends AppCompatActivity {
public static final int ADD_NOTE_REQUEST_CODE = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.createnotepage);
Button createTextNote = (Button) findViewById(R.id.createTextNoteBtn);
createTextNote.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivityForResult(
new Intent(getApplicationContext(), CreateNoteActivity.class),
ADD_NOTE_REQUEST_CODE
);
}
});
getNotes();
}
private void getNotes() {
@SuppressLint("StaticFieldLeak")
class GetNotesTask extends AsyncTask<Void, Void, List<Note>> {
@Override
protected List<Note> doInBackground(Void... voids) {
return NotesDatabase.getDatabase(getApplicationContext()).noteDao().getAllNotes();
}
@Override
protected void onPostExecute(List<Note> notes) {
super.onPostExecute(notes);
}
}
new GetNotesTask().execute();
}
}