[Solved] How convert my existing activities to fragment with the same functionality and layout?

You need to create a new fragment, and add the functionality from the activity’s life cycle to the fragment’s life cycle. For example: your activity’s onCreate()’s code should be implemented in onCreateView() of the fragment, off course you’ll have to change some stuff like inflatting the view and returning it instead of calling setContentView(R.layout.id). Implement … Read more

[Solved] Nullpointer Exception in SQL, Listivew

Your class member model from class InputTab has never initialized. Therefore, you got a NPE at line model.requery();. That’s why you saved your data, but right after that, you got a NPE. You don’t need any Cursor in this class and, of course, you don’t need to requery() anything. 2 solved Nullpointer Exception in SQL, … Read more

[Solved] How to pass JSON data from ListView to new activity

You can send an object as a parameter to another activity if the object implements Parcelable: A typical implementation of Parcelable here Then, to send like parameter, something like this: Intent intent = new Intent(this, DetailMovieActivity.class); intent.putExtra(“key”, movie);//Your object that implements Parcelable startActivity(intent); And in the other activity: Bundle arguments = new Bundle(); Movie movie … Read more

[Solved] Implement A Mutli Level Listview [closed]

It sounds like you’re looking for an ExpandableListView (docs here). However, it does not allow the level of nesting that you need. To be honest though, I’d recommend against nesting items that deeply into a ListView setup using only ListViews. It makes navigation of the list items difficult/ messy (not to mention the programming side … Read more

[Solved] how can i make spinner inside alert dialog box in android?

Replace your code with this: public class SubMenu extends AppCompatActivity { JSONObject jsonobject; JSONArray jsonarray; ListView listview; ListViewAdapter adapter; ProgressDialog mProgressDialog; ArrayList<HashMap<String, String>> arraylist; static String RANK = “id”; static String COUNTRY = “name”; static String FLAG = “image”; Integer i = 1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sub_menu); Toolbar toolbar = (Toolbar) … Read more

[Solved] Spinner in a listview in android [closed]

If you want to display a spinner for every list item clicked in ListView. Its possible with AlertDialog. Try to create the alert dialog with radio buttons by using this and try this block list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { AlertDialogView(); } } And the code for … Read more

[Solved] My ListView is null and i don’t get why

Introduction If you are having trouble understanding why your ListView is null, you are not alone. Many developers have encountered this issue and have had difficulty resolving it. This article will provide an overview of the common causes of a null ListView and provide some tips on how to troubleshoot and resolve the issue. We … Read more

[Solved] Add items to listview from other activity

new View.OnClickListener() { public void onClick(View arg0) { EditText edit = (EditText) findViewById(R.id.tskname); Intent i = new Intent(AddTask.this, MainActivity.class); //Bundle bundle = new Bundle(); String TaskName = edit.getText().toString(); //bundle.putString(“NewTask”, TaskName); i.putExtra(“NewTask”, TaskName); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //i.putExtras(bundle); startActivity(i); } }); You are starting a new Activity each time you want to add an item. Consider using startActivityForResult() Link … Read more

[Solved] How to make a SearchView/filter on a custom ListView and add items in the underlying ArrayList using an EditText? [closed]

i suggest you start using Recycler view since it would be easier to do this functionality using it. here is your starting point: RecyclerView RecyclerViewAdapter Creating lists with Custom rows solved How to make a SearchView/filter on a custom ListView and add items in the underlying ArrayList using an EditText? [closed]

[Solved] Android SQLite data display to ListView

The Cursor must include a column named “_id” or this class (CursorAdapter and descendants) will not work. COL_ID should be “_id” or you can try to use a workaround by making alias: String[] allColumns = new String[] { SqlDbHelper.COL_ID + ” AS ” + BaseColumns._ID, … See CursorAdapter 11 solved Android SQLite data display to … Read more