Comments (2)
Hi ablozhou,
in Java, you need to "declare" all classes being used either by importing them
or by refering to them with there fully qualified name. So you have two choices
to make it work:
1. import the inner class "OnRangeSeekBarChangeListener":
import <your-package-name>.RangeSeekBar.OnRangeSeekBarChangeListener;
2. Import class "RangeSeekBar" and refer to "OnRangeSeekBarChangeListener" the
following way:
seekBar.setOnRangeSeekBarChangeListener(new
RangeSeekBar.OnRangeSeekBarChangeListener<Double>() { ...
Original comment by [email protected]
on 14 May 2012 at 8:04
- Changed state: Invalid
from range-seek-bar.
hey hii i am tejas i am gatting an errror in [seekBar = (seekBar)
findViewById(R.id.SeekBar01);] code and in [mediaPlayer =
MediaPlayer.create(this,R.raw.testsong_20_sec);]code
the error is in raw word and in line of [findViewById(R.id.SeekBar);
i am giving u the whole set of code also below:
package teja.MusicPlayer.main;
import teja.MusicPlayer.main.R;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.SeekBar;
public class MusicPlayerActivity extends Activity {
private Button buttonPlayStop;
private MediaPlayer mediaPlayer;
private SeekBar seekBar;
private final Handler handler = new Handler();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
private void initView(){
buttonPlayStop = (Button) findViewById(R.id.ButtonPlayStop);
buttonPlayStop.setOnClickListener(new OnClickListener() {
public void onClick(View v){buttonClick();}});
mediaPlayer = MediaPlayer.create(this,R.raw.testsong_20_sec);
seekBar = (seekBar) findViewById(R.id.SeekBar01);
seekBar.setMax(mediaPlayer.getDuration());
seekBar.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent arg1) {
// TODO Auto-generated method stub
seekChange(v);
return false;
}
});
}
public void startPlayProgressUpdater() {
seekBar.setProgress(mediaPlayer.getCurrentPosition());
if (mediaPlayer.isPlaying()) {
Runnable notification = new Runnable() {
public void run() {
startPlayProgressUpdater();
}
};
handler.postDelayed(notification,1000);
}else{
mediaPlayer.pause();
buttonPlayStop.setText(getString(R.string.play_str));
seekBar.setProgress(0);
}
}
private void seekChange(View v){
if(mediaPlayer.isPlaying()){
SeekBar sb = (SeekBar)v;
mediaPlayer.seekTo(sb.getProgress());
}
}
private void buttonClick(){
if (buttonPlayStop.getText() == getString(R.string.play_str)) {
buttonPlayStop.setText(getString(R.string.pause_str));
try{
mediaPlayer.start();
startPlayProgressUpdater();
}catch (IllegalStateException e) {
mediaPlayer.pause();
}
}else{
buttonPlayStop.setText(getString(R.string.play_str));
mediaPlayer.pause();
}
}
}
plzzzz tell me the solution to get reed of this problem.....
Original comment by [email protected]
on 1 Jun 2012 at 4:25
from range-seek-bar.
Related Issues (20)
- Implemented XML usage of widget. HOT 3
- Setting the Min And Max of RangSeeBar after onlistener is called HOT 2
- Code review request
- Need Listener like OnProgressChanged of Seekbar HOT 2
- how to set min and max progress just like calling setProgress(10) HOT 1
- Integer rounding bug.
- Code review request
- Code review request
- Provide widget via Maven
- provide thumbs also for xxhdpi devices
- InstantiationException: HOT 1
- Code review request
- How to use seekbar dynamic
- Code review request
- How to set new range limit? HOT 1
- is this possible to change progress interval to 500,1000,1500 instead of 1,2,3 in range seekbar..? HOT 3
- Displaying the minimum and maximum values by the side of thumbs say in textview HOT 3
- Code review request
- Move project to Github
- Unable to start activity ComponentInfo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from range-seek-bar.