• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Playing different sounds on different buttons click

Hi guys,

I am new to android and I want to make a simple app for learning purposes.
So the app should be like this: if I press Button1, it will sing the sound1. If I press Button 2 the sound1 stops and plays sound2.
Here is what I made so far, but it doesn't work. I tried to search on different websites, but I didn't find anything that could help me so I thought it would be helpful a forum.
Any help please? :D

Thank you!

Java:
package com.example.moan;

import androidx.appcompat.app.AppCompatActivity;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    MediaPlayer cricket;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        Button btnCricket = (Button) this.findViewById(R.id.button);
        btnCricket.setOnClickListener(this);

        Button btnCricket2 = (Button) this.findViewById(R.id.button2);
        btnCricket2.setOnClickListener(this);




    }

    @Override
    public void onClick(View v) {
        switch(v.getId())  {
            case R.id.button:
                closeCricket();
                cricket = MediaPlayer.create(this, R.raw.manea1);
                break;
            case R.id.button2:
                closeCricket();
                cricket = MediaPlayer.create(this, R.raw.manea2);
                break;
            default:
                return;
        }


        cricket.start();


    }

    public void closeCricket() {
        if (cricket.isPlaying()) {
            cricket.pause();
            cricket.reset();
            cricket.release();
        } else {
            cricket.reset();
            cricket.release();
        }

    }
}

Converting Blob to String in Android Room

I'm having trouble finding information on how to resolve an issue with reading file BLOB data with Android Room.

The Problem:
In the database there are 11 tables and one table called Files handles file attachments. There are 3 fields, FileID, Filename, FileData. FileData is the BLOB or byte data stored to build the file. The file can be anything, a picture, text file, Word, Excel, just about anything.

What I've tried:
I can't seem to find, if it exists, how I would setup my entity class to manage this field data. I searched on stackoverflow and developer.android.com but haven't discovered anything helpful yet. I did see that there is a method called getBlob() (https://developer.android.com/reference/android/database/Cursor.html#getBlob(int)) but this is related to the Cursor method, which Android Room handles all the Cursors.

I'm not sure where to go from here, so I was hoping someone may have had the same issue or knew how you would setup your Room code (e.g. Entities, etc) to manage this file data.

[Game][Free] Accumulate Ball

Hey,

An original arcade puzzle game Accumulate Ball for Android has been developed by our studio. You are welcome to test (comment): https://play.google.com/store/apps/details?id=com.eidnGames.AccumulateBall&hl=en.

1. Promo video
Gameplay is simple and contains the next parts:

1.1) Moving the ball through platforms to find a path to a reservoir with a substance of the specific color.

1.2) Filling the ball with the reached substance.

1.3) Repeating the steps 1.11.2 until the ball won't be completely filled.

2) Restoring the ball to a state before the step 1.1 and continuing the steps 1.11.3.


2.1. Smartphone screenshot


2.2. Smartphone screenshot


2.3. Smartphone screenshot
Game process is complicated by the following features:

1) It is necessary to find a path to a reservoir until the timer is stopped.

2) The ball orientation can be changed by rotators located at random platforms.


3.1. Tablet screenshot


3.2. Tablet screenshot


3.3. Tablet screenshot
This game has been made with Unity, in case someone is wondering.

Won't turn on

I made around 4 attempts: 2 hours, overnight, around 4 hours, and overnight but with a wireless charger.
as @mikedt has said, the battery is dead and needs replacing.......not an easy thing to do on the s6 edge.

but if you like dyi projects, here you go:
https://www.ifixit.com/Guide/Samsung+Galaxy+S6+Edge+Battery+Replacement/47480

ifixit also sells the parts needed as well.......good luck

Application runs fast on smartphone but slow on tablet

Hello,
My team and I have developped an augmented reality application that uses native c++ libraries, it works well on multiple smartphones (xiaomi, samsumng, huawei, custom industrial android phones), but when it comes to tablet, the activity that contains the frames acquisition and manipulation runs slow.

We have tried on multiple table, the specs of the first ones weren't that great (under 2Gb ram, 4 cores below 1.7ghz and armeabi-v7a), but then we bought a tablet that has the same, or even better specs than the previously tested smartphones ( Lenovo M10+, with 4Gb ram, Octo core 2.3Ghz, armeabi-v8a), but the speed issue remains.

The code uses some shared libraries compiled for the specific architectures (opencv, ceres-solver), and the optimisation is set in the manifest.
FYI, android developpement isn't our strong suit.
Do you have any idea to why an app can be fast on smartphones but not on tablet ?

Thanks in advance.

SNIPER DRONE SIMULATOR [GAME] [FREE]

The game DO NOT use graphics, you will play in real life scenarios (real people and targets)
The story : A new terrorist organization called DARK NET is after Nuclear Weapons. They have connections worldwide. You, HAWK07, are a black OPS agent with a drone which can fire a sniper bullet or a missile. Your mission is to eliminate the threat using the available drone without asking for any support from the government. Android Download : <a href='https://play.google.com/store/apps/details?id=com.sadshrimp.oneshot'>https://play.google.com/store/apps/details?id=com.sadshrimp.oneshot</a>
Watch game play here :

Need serious HELP - Data Recovery (i.e. texts, photos etc..) after accidental factory reset protocol

Maybe you're befuddling the SIM card with a microSD card? The SIM cards isn't utilized or even open as capacity media, it contains your record data with your cell bearer. The SIM card is the thing that confirms your telephone to utilize their cell administration - for example move your SIM to an alternate telephone and that telephone will at that point have the option to utilize your picked transporter's cell arrange (well, given the telephone itself underpins that bearer). Be that as it may, a microSD card is what's planned to be utilized as supplemental stockpiling media. You can promptly move documents between your telephone's inward stockpiling and your microSD card, and afterward expel the card to move records to and fro to different telephones or different gadgets (cameras, PCs, workstations, and so forth.) that have SIM openings. Now despite the fact that you can't sign into your telephone, you can control if off and still evacuate your microSD card. Simply remember that in the event that you didn't really set things up so your information was getting supported up to your card, you won't discover much on it. Did you recently set the camera application to utilize your microSD card as it's default stockpiling area? Or then again set up any applications to utilize the card as default stockpiling? If not, that stuff is still most likely on your telephone's inner stockpiling. Things like email, contacts, schedule information ought to be open to you have been adjusting those things to your online email account.

Be that as it may, returning to your concern, on the off chance that you've overlooked your secret phrase, here's a guide on various things to attempt to reset it:
https://www.quicktechnicalsupport.com/google-account-recovery-phone-number
When you do deal with your telephone once more, make certain to set aside the effort to set up a programmed back up arrangement. Reinforcements are significant.

Weird issues with Note 10+

Ok, so just got the new router delivered. Just hooked it up. The new router was able to use all the same ssid and keys. I turned off the wifi on my modem router combo. So far, all the issues I've had went away. I can now download apps, see facebook posts and use my ring app to view live video. Dont know why this phone just wasn't compatible with our old router but worked just fine for my wife's phone.

Needing help with getting wife a new phone :)

I'll cast a vote for the Galaxy Note as well. A lot of people (like me) love the Note line because of the S Pen. While the extra functionality of the S Pen is great, my fingers just don't like to hit their intended target. Using the S Pen allows me to type, tap, draw, mark, etc with surgical precision. I was a huge fan of the Note 8... but the Note 9 made me forget all about it. I have my Note 9 on ebay right now... please PM me for the link, as I'm not here to sell a phone.

How do I stop instant apps from downloading?

I know this is an older topic, but our friend @MrJavi brought this up to my attention today(that I don't know why)..so since I'm kind of perfectionist personality wise..I don't like to leave things unfixed..so here it is..

Ok, so here is the solution I came up with to this annoying app to appears out off the nothingness and nests inside your partition(I compared that situation going on in there like if you have an unwelcome friend living in my house that run out of her welcomes about a year ago or so..(which she is the Google play store)..then out of the blue she brings her latest squiced(this would be the Google instant apps) to live with her too..in my house..that's a very very very messed up situation..

So any way..straight to business, so all you have to do is go to app manager, then to to Google play store, data usage, then check the Restriction Background Data box..this will prevent from the infamous Google play store to generate to origins of the Google instant apps..

So the culprit really is the Google play store..so with that being done..the instant app won't hatch ever again in your phone unless you uncheck that box..the minute you do it..WATCH!!

Now, if you are rooted, and you use an internet guard app..you can also make a prevention inside there from the Google play store to acquire data internet too..like a double layer..that's how I have it..just in case the indign quite app goes through the first layer..

I also uninstalled the Google play store updates while I'm checking that box I'm taking about..but you have to do all this quickly..because that sneaky will do her act very swift right before your eyes..and before you know it she would already generate the instant apps + her own updated in a matter of a little tinny moment..

Here's from me to you all..

Help Dialer Storage??

Well go into you app manager (I think that's what Samsung still call what is "Settings > Apps" on every other android device), find this app and look at its storage usage. That will tell you how much is the app's data and how much is the app itself. It's quite possible that it's almost all the app, in which case apart from uninstalling updates (assuming you don't allow apps to update automatically and can ignore the constant reminder that there is an update to this one) or disabling the app there's nothing much you can do about it.

Help rooting

It unlockes lost of performance capability that's blocked by manufactures I tried 1 click root and I'm not wanting to waste 30$ if it don't work or if I can have it done cheeper online

Im have never used Oneclickroot. The preferred method is to install a custom recovery like TWRP and flash Chainfile SuperSu or Magisk. Its important to have an unlocked bootloader. Also follow steps to open "developer Options and enable USB setting to connect to a pc. Go to about pone and tap buildnumber 5 to 7 times. Theme go back and look for a new "developer options" settings. Be aware of FRP lock as you will need to know you Google pasword. If you forget it you'll be permanently lock out of your device .

Filter

Back
Top Bottom