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

2 years 1 month 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

2 years 1 month ago

Thank you ....

Thank you ....

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 05/13/2026 - 10:33
    gurux.dlms.cpp 9.0.2605.1301
  • Mon, 05/11/2026 - 11:07
    Gurux.DLMS.Go 1.0.17
  • Mon, 04/27/2026 - 08:37
    Gurux.DLMS.Go 1.0.16
  • Thu, 04/23/2026 - 13:19
    Gurux.DLMS.Net 9.0.2604.2101
  • Tue, 04/14/2026 - 11:47
    gurux.dlms.java 4.0.93

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin