我在我的代码中设置了通知侦听器。每当我收到通知时,我都想在我的linear layout
活动中放置一个文本视图,该视图最初没有任何内容。
当第二个通知到达时,我想在前一个文本视图下方再添加一个文本视图。
public class InformationActivity extends Activity
{
public static VideoInformationClass vidInfo = new VideoInformationClass() ;
public static LinearLayout lv ;
public static LayoutParams textViewParams;
public static TextView tv ;
public static TextView tv1,tv2,tv3,tv4,tv5,tv6,tv7,tv8,tv9,tv10;
static int fieldFrequency;
static int numberOfFrameLines;
static int numberOfVisibleLines;
static int numberOfVisiblePixels;
static int interlace;
static int imageFormat;
static int videoCoding;
static int scanType;
VideoPropertiesParams GetParams;
VideoPropertiesParams VP;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.information_activity);
Context context = getBaseContext();
LinearLayout lv = new LinearLayout(this);
lv.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// tv = new TextView(this);
}
@Override
protected void onStart() {
// TODO Auto-generated method stub
super.onStart();
onFieldFrequencyChanged();
onImageFormatChanged();
onInterlacedChanged();
/*vidInfo.RegisterVidPropertyListener();
vidInfo.RegisterSignalAndPresenceListener();
vidInfo.RegisterThreeDChangeListener();*/
if (ControlUnit.flag) {
GetParams = vidInfo.GetVideoProperty();
Log.i("TvPlayerFunctionalTestApp","Get Video Property called");
fieldFrequency = GetParams.fieldFrequency;
numberOfFrameLines = GetParams.numberOfFrameLines;
numberOfVisibleLines = GetParams.numberOfVisibleLines;
numberOfVisiblePixels = GetParams.numberOfVisiblePixels;
interlace = GetParams.interlace;
imageFormat = GetParams.imageFormat;
videoCoding = GetParams.videoCoding;
scanType = GetParams.scanType;
}
/* tv.setText("Something");
tv.setLayoutParams(textViewParams);
lv.addView( tv );*/
}
@Override
protected void onStop() {
// TODO Auto-generated method stub
super.onStop();
/*vidInfo.UnRegisterSignalAndPresenceListener();
vidInfo.UnRegisterThreeDChangeListener();
vidInfo.UnRegisterVidPropertyListener();*/
}
public void onFieldFrequencyChanged(){
String info = "On field frequency changed , value is " + vidInfo.ChangedFrequency;
tv = new TextView(this);
tv.setText(String.valueOf(info));
LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
tv.setLayoutParams(textViewParams);
lv.addView(tv);
}
public void onImageFormatChanged() {
String info = "On Image Format changed , value is " + vidInfo.ChangedFormat;
tv1 = new TextView(this);
tv1.setText(String.valueOf(info));
LinearLayout.LayoutParams textViewParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
tv1.setLayoutParams(textViewParams);
lv.addView(tv1 );
}
public void onInterlacedChanged() {
String info = "On Interlaced changed , value is " + vidInfo.InterlaceChange;
tv.setText(String.valueOf(info));
LinearLayout.LayoutParams textView
Params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
tv.setLayoutParams(textViewParams);
lv.addView(tv);
}