Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. How Can Initialize MediaSettings In Android Activity

how can initialize MediaSettings in android activity

By Akash, 3 April, 2024
Forums
Gurux DLMS for Android

package gurux.dlms.android.ui.media;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;

import gurux.dlms.android.R;
import gurux.dlms.android.databinding.FragmentMediaBinding;

public class MediaFragment extends Fragment {

private FragmentMediaBinding binding;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
MediaViewModel mediaViewModel =
new ViewModelProvider(requireActivity()).get(MediaViewModel.class);

binding = FragmentMediaBinding.inflate(inflater, container, false);
View view = binding.getRoot();
Fragment childFragment = mediaViewModel.getDevice().getMedia().properties();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.replace(R.id.media_fragment_container, childFragment).commit();
return view;
}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

Profile picture for user Kurumi

Kurumi

1 year 11 months ago

Hi, You need to get the…

Hi,

You need to get the media and then you can change the settings.
Something like this for serial port:

GXSerial serial = (GXSerial) mediaViewModel.getDevice().getMedia();
serial.getBaudRate();

BR,
Mikko

Akash

1 year 10 months ago

Thank you ....

Thank you ....

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 02/19/2026 - 11:51
    gurux.dlms.cpp 9.0.2602.1901
  • Sun, 02/01/2026 - 19:47
    gurux.dlms.cpp 9.0.2602.0101
  • Tue, 01/20/2026 - 10:38
    gurux.dlms.java 4.0.89
  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5

New forum topics

  • Help with connection and read with landis+gyr e650 + CU-E22 using python
  • Preestablished connection
  • RJ11 to RS232 Pin out SECURE Premier 300
  • GENUS sugam 3 PH bidirectional
  • Electricity smart Meter DLMS firmware stack
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin