I want when the user clicks the icon "Add Video" button, create a dialog in which he can insert a link, which he copied.
After that, pressing the "ok" button will load the page that the user entered (from youtube) and from there take a video ID. Will store everything about this element <meta itemprop =" videoId "content =" lWHKaK7Ql3k ">
.
Search for ID can be advised by means JSOUP library, but I found examples of html. Once we obtain the ID, we try to get a picture.
Prompt please as it is possible to generate an image with added video and add it to the list, as shown in the screenshot.
My code with dialog:
private void showAddVideoDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setTitle("Add video");
View viewInflated = LayoutInflater.from(getContext()).inflate(R.layout.view_layout_add_video, (ViewGroup) getView(), false);
final EditText input = (EditText) viewInflated.findViewById(R.id.edt_videoUrl);
builder.setView(viewInflated);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
m_Text = input.getText().toString();
Toast.makeText(getContext(), "ОК", Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
Toast.makeText(getContext(), "Отмена", Toast.LENGTH_SHORT).show();
}
});
builder.show();
}
Non-sarcastic/non-condescending responses are greatly appreciated.