[Solved] How do I create a ListView like the YouTube App? [closed]

The most important thing to apply this kind of design is properly implement adapter, which will represent every piece of data (one video in your situation). More or less in for situation it will look like: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content”> //you main picture <ImageView android:layout_width=”fill_parent” android:layout_height=”fill_parent”> //layout to place other info like number of likes, … Read more

[Solved] Android JSON Parse

You should use next code: JSONArray jsonArray = new JSONArray(response); JSONObject jsonObject = jsonArray.getJSONObject(0); Log.d(“ID -> “, jsonObject.getString(“id”)); Log.d(“CAT -> “, jsonObject.getString(“cat”)); Because you have not an object in json, but an array, so you should create array instead of object. And thats why your modification works. Because in modified code “data” is an object … Read more

[Solved] How can i make the app work offline with Firebase database

Simply activate offline persistens as specified in the official documentation: Firebase applications work even if your app temporarily loses its network connection. You can enable disk persistence with just one line of code: FirebaseDatabase.getInstance().setPersistenceEnabled(true); solved How can i make the app work offline with Firebase database

[Solved] I have around 1000 different activities in my Android App. How can I jump to a random activity?

Although this is terrible, I’ll still show a possible way to do this. But just remember, this is TERRIBLE. You can store all the activity classes in an ArrayList. ArrayList<Class<Activity>> activities = new ArrayList<> (); And then you add all the activities into the ArrayList. Yeah, I know, this part is tedious. For example, activities.add … Read more

[Solved] App crashing. Why? [closed]

it cannot find the method corresponding to your button maybe u changed the button or delete it and make it again …write from scratch and this time be careful with the button and its method not to have any conflict! ps. maybe your manifest file is missing something …app crashing is sometimes from there too! … Read more

[Solved] How to combine two audio files on top of each other in android [closed]

You don’t need FFMPEG, you can use the standard codecs available in android. public void playFile(String fileToPlay) { // see where we find a suitable autiotrack MediaExtractor extractor = new MediaExtractor(); try { extractor.setDataSource(fileToPlay); } catch (IOException e) { out.release(); return; } extractor.selectTrack(0); String fileType=typeForFile(fileToPlay); if (fileType==null) { out.release(); extractor.release(); return; } MediaCodec codec = … Read more

[Solved] Is it possible to store else-if statements in a XML file and call it from activity?

Why don’t you create the URL with the pos value directly ? You’ll avoid your if/else statements. It would be something like that int pos = getIntent().getIntExtra(“key”,0); String url = “file:///android_asset/”+pos+”.html” web.loadUrl(url); Ok it seems like you have different file names. So what you can do is store those in a Map. Map<Integer, String> map … Read more

[Solved] How can I check if the user has installed an app?

Define a method that returns true if the PackageManager can find it: Example: private boolean checkThisApp(String uri) { PackageManager myPackageManager = getPackageManager(); boolean app_installed; try { myPackageManager.getPackageInfo(uri, PackageManager.GET_ACTIVITIES); app_installed = true; } catch (PackageManager.NameNotFoundException e) { app_installed = false; } return app_installed; } and use it in the Activity/Fragment like: boolean isAppInstalled = checkThisApp(“com.facebook.katana”); 1 … Read more

[Solved] Does the Activity need to be Serializable when sending a class that implements Serializable through Intent and putExtra?

Does i.putExtra(String name, Serializable s) require the Activity where the Intent is sent from to implement Serializable? No, but it does mean that s cannot refer to the activity or other non-Serializable stuff or you will need to take steps to prevent the serialization from trying to serialize them (e.g., override the methods described in … Read more