在我的Android相机应用程序中,我已将应用程序清单设置为Portrait.但是当我正在运行我的相机应用程序时,相机预览显示为横向而不是纵向.
我不知道问题出在哪里,但我需要帮助.我想将我的相机预览设置为普通相机预览.并将应用程序设置为纵向.
有什么解决方案吗?
在我的应用程序中,我将播放VideoView.
我没有使用Media Controller作为播放,暂停和停止等变量选项.
而不是我使用单个按钮来使用播放和暂停功能.
我有像下面的代码实现:
case R.id.playVideoBtn:
if(myVideoView.isPlaying()){
myVideoView.pause();
}else{
//MediaController ctlr=new MediaController(this);
// ctlr.setMediaPlayer(myVideoView);
//myVideoView.setMediaController(ctlr);
myVideoView.start();
}
break;
Run Code Online (Sandbox Code Playgroud)
现在我很想知道如何为同一个Button Click实现Pause功能.
请帮帮我.
谢谢.
android android-ndk android-video-player android-layout android-videoview
在我的应用程序中,我使用此线程在时钟上旋转秒针.但问题是当我关闭活动时,线程仍然保持运行.我想停止线程,因此它无法影响设备的Bettry.
下面是我的活动代码,我在旋转时钟的秒针:
public class ClockActivity extends Activity implements OnClickListener{
private Button chimeBtn;
private ImageView img;
private Thread myThread = null;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.clock_layout);
Runnable runnable = new CountDownRunner();
myThread = new Thread(runnable);
myThread.start();
chimeBtn = (Button) findViewById(R.id.chimeBtn);
chimeBtn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.chimeBtn:
playSound(R.raw.one_bell);
break;
}
}
public void playSound(int resources){
MediaPlayer mp = MediaPlayer.create(getApplicationContext(), resources);
mp.start();
}
private void doPlay(){
new Thread(new Runnable() {
@Override
public void run() {
// …Run Code Online (Sandbox Code Playgroud) 我想将Edittext设置为,无论我写什么并输入EditText,它都应该在同一时刻写入TextView.
我认为可以通过添加任何istener来实现.我无法实现它.所以请任何人帮助我.?谢谢.
includedText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if(!(includedText.getText().toString().equals("")))
{
double included = Double.parseDouble(includedText.getText().toString());
included = roundTwoDecimals(included);
// double amountValue = (excluded*15/100);
String amt = String.valueOf(roundTwoDecimals(included-(included/1.15)));
String excluded = String.valueOf(included/1.15);
System.out.println("The Amount is: "+amt);
amountText.setText(amt);
try{
excludedText.setText(excluded); //////// Error
}
catch(Exception e)
{
e.printStackTrace();
}
}
else
{
amountText.setText("");
//excludedText.setText("");
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我使用此代码在Facebook上发布照片.
码:
// For Facebook ===================================
Button facebookButton = (Button) saveButtonDialog.findViewById(R.id.facebook);
facebookButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
saveButtonDialog.dismiss();
saveImageFunction(); // to save the Image
facebook.authorize(TWSBIDrawMainActivity.this, new String[]{ "user_photos,publish_checkins,publish_actions,publish_stream"},new DialogListener() {
@Override
public void onComplete(Bundle values) {
postImageonWall();
Toast.makeText(getApplicationContext(), "Image Posted on Facebook.", Toast.LENGTH_SHORT).show();
}
@Override
public void onFacebookError(FacebookError error) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onCancel() {
}
});
}
});
public void postImageonWall() {
byte[] data = null;
Bitmap bi …Run Code Online (Sandbox Code Playgroud) 我已经为我的设备实现了通知.
它很棒.但是,如果我重新启动设备,它根本不会工作.
那有什么不对吗?我应该在清单中添加anithing吗?
我已添加此代码以接收通知类的广播.
码:
<!-- To receive the Alarm Notification -->
<receiver android:name=".AlarmNotificationReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"></action>
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
谢谢.
notifications android push-notification android-manifest android-notifications
我知道可以改变android中任何小部件的样式.但是,我尝试使用Seekbar.我想有像android 4.0那样的搜索栏.我的应用程序在Android 2.2中运行,我想显示像Android 4.0这样的搜索栏.
那么,应该改变什么呢?
我试过下面的代码:
<style name="seekbarStyle" parent="android:Widget.SeekBar">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
<item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item>
<item name="android:minHeight">20dip</item>
<item name="android:maxHeight">20dip</item>
<item name="android:thumb">@android:drawable/seek_thumb</item>
<item name="android:thumbOffset">8dip</item>
<item name="android:focusable">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)
请帮我.我希望搜索栏样式在所有设备中看起来像android 4.0.
android seekbar android-widget android-4.0-ice-cream-sandwich
android ×7
android-ndk ×2
android-4.0-ice-cream-sandwich ×1
facebook ×1
runnable ×1
seekbar ×1