activity

android – Navigating to parent activity


I have two flavors one is free and another one is paid

I have the code only in main—> Java folder trying to figure the code which is free and paid and leaving free and paid folders empty.

Now I have MainActivity which launches from that user navigates to Activity A, Activity B…

When User goes to Activity A and perform some operations he would like to navigate to parent activity ie…MainActivity he clicks on up navigation.

Here comes the problem

When he clicks up navigation how do I come to know he has to go to parent activity using flavor

I have set up my gradle file as shown below:

 productFlavors {
    free {
        applicationId "com.abc.xyz.free"
        versionName "${versionMajor}.${versionMinor}.${versionBuild}"
        buildConfigField "boolean", "PAID_VERSION", "false"
        resValue "string", "android:value", applicationId
        dimension "version"
    }

    full{
        applicationId "com.abc.xyz.full"
        versionName "${versionMajor}.${versionMinor}.${versionBuild}"
        buildConfigField "boolean", "PAID_VERSION", "true"
        dimension "version"
    }
}

I’m unable to figure how does I change the android value in manifest file :

  <activity
        android:name=".ActivityA"
        android:label="ActivityA"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="stateHidden"
        android:launchMode="singleTop">
        <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity"></meta-data>
    </activity>
    <activity
        android:name=".ActivityB"
        android:label="ActivityB"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="stateHidden">
        <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity"></meta-data>
    </activity>



لینک منبع

php – Blank Screen when adding a moodle (3.1.7) activity to a course


I have installed a LAMP with PHP 5.4.16, Maria DB and Moodle 3.1.7 on Red Hat Enterprise Linux 7.

When i am pressing the Button “Add an activity or ressource”, the popup opens to select the activity/ressource, but when i click the “Add”-Button i get a blank screen (Chrome says HTTP 500).

What can be the origin of this?

With best regards,
Bjoern



لینک منبع

java – More than almost 30 Media Players in an activity don’t start in android programming


I have a project and about 37 button in an activity that they play a sound by media player but when I press about 30 buttons the rest of the buttons won’t start and the buttons do nothing . Here is a little part of my code :

import android.media.MediaPlayer;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    MediaPlayer mediaPlayer;
    Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mediaPlayer = MediaPlayer.create(this, R.raw.ability);
        btn = (Button) findViewById(R.id.btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mediaPlayer.isPlaying()) {
                    mediaPlayer.seekTo(0);
                }else {
                    mediaPlayer.start();
                }
            }
        });
    }
}

Please Help Me !!!!!



لینک منبع