Android studio用户创建选项卡并编辑

Android studio用户创建选项卡并编辑,android,Android,我正在制作一个叫做书签的应用程序。 该应用程序允许你制作“标签”,用户可以在其中存储链接和名称 我已完成所有设置(webview、webview客户端、设置选项卡、应用程序首选项管理器等) 我在一个导航抽屉里工作 我想要达到的目标: 用户可以创建包含链接和名称的选项卡。 用户可以在设置菜单中添加/删除/编辑选项卡 我就是不知道该怎么办,希望你能帮我 编辑: 现在,正如您所希望的那样,提供一个删除选项卡的示例: 您可以使用以下适配器设置listview: listView.setAdapter(n

我正在制作一个叫做书签的应用程序。 该应用程序允许你制作“标签”,用户可以在其中存储链接和名称

我已完成所有设置(webview、webview客户端、设置选项卡、应用程序首选项管理器等)

我在一个导航抽屉里工作

我想要达到的目标:

用户可以创建包含链接和名称的选项卡。 用户可以在设置菜单中添加/删除/编辑选项卡

我就是不知道该怎么办,希望你能帮我

编辑:

现在,正如您所希望的那样,提供一个删除选项卡的示例:

您可以使用以下适配器设置listview:

listView.setAdapter(new ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)
对于对象,可以将ArrayList与表示选项卡的对象一起使用

listView.setOnItemClickListener(new OnItemClickListener() {
  @Override
  public void onItemClick(AdapterView<?> parent, View view,
    int position, long id) {
    //Verify operation by user
    AlertDialog.Builder builder = new AlertDialog.Builder(view.getActivity());
    builder.setMessage("Are you sure you want to delete the selected Tab?")
           .setPositiveButton("Yes delete", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                   //Call a delete method

               }
           })
           .setNegativeButton("No don't delete", new DialogInterface.OnClickListener() {
               public void onClick(DialogInterface dialog, int id) {
                   // Nothing to do
               }
           });
    // Create the AlertDialog object and return it
    return builder.create();
  }
}); 

我想到了一个文件,用户可以在其中写入名称和url,您可以使用一个方法获取文件中的所有内容并将其放入选项卡中。您还可以使用SQLite DB,它是构建的。例如,您可以在设置中修改它,然后读取onCreateView()中的所有选项卡。好吧,假设我需要两个按钮创建一个选项卡并删除一个选项卡,我该怎么做?对于删除,我建议使用listview。使用onItemClick()命令,该命令将询问用户是否确实希望删除所选项目。而不仅仅是使用sql语句删除指定的选项卡。在创建时,您将使用2个editText视图,您可以在其中写入名称和url。在按钮的click方法中,您将从editText视图中读取文本,然后将其写入sqlite db。好吧,那么我如何实现它呢?
final Button buttonCreate = (Button) findViewById(R.id.createTab);
         button.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                 if(v.equals(buttonCreate){
                 //Accessing UserInput
                 EditText userInputName =(EditText)findViewById(R.id.name);
                 String inputName = userInputName.getText().toString();
                 EditText userInputURL = (EditText)findViewById(R.id.url);
                 String inputUrl = userInputURL.getText().toString();
                 //Call a creation method with inputName and inputUrl
                 }
             }
         });