بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
دوستان خواهشا کمک کنید(لیست ویو خیلی ضروریه)
دوستان من کدها رو می زارم شما کمک کنید من کجا اشتباه کردم و باید چکار کنم منتظر یاری سبز شما هستم.
لیستی از فایل های داخل پوشه raw رو گرفتم وبا کلیک روی هر آیتم به صفحه بعد می ره اما حالا شما کمک کنید
public class StringArrayAdapter extends BaseAdapter {
int[] names;
Context ctxt;
LayoutInflater myInflater;
public StringArrayAdapter(int[] arr, Context c) {
names = arr;
ctxt = c;
myInflater = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return names.length;
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return names[arg0];
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
if (arg1 == null) {
arg1 = myInflater.inflate(android.R.layout.simple_list_item_1, arg2, false);
TextView name = (TextView) arg1.findViewById(android.R.id.text1);
name.setText(names[arg0]);
}
return arg1;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class Player extends Activity implements View.OnClickListener {
MediaPlayer mp;
ArrayList<File> mySongs;
SeekBar sb;
Button btPlaye, btFF, btFB, btNext, btPre;
int position;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.player);
btPlaye = (Button) findViewById(R.id.btPlay);
btFF = (Button) findViewById(R.id.btFF);
btFB = (Button) findViewById(R.id.btFB);
btNext = (Button) findViewById(R.id.btNext);
btPre = (Button) findViewById(R.id.btPre);
Intent i = getIntent();
Bundle b = i.getExtras();
mySongs = (ArrayList) b.getParcelableArrayList("songList");
position = b.getInt("pos");
Log.i("", mySongs + "");
Log.i("", position + "");
final Uri u = Uri.parse(mySongs.get(position).toString());
// mp = MediaPlayer.create(getApplicationContext(), R.raw.a);
// mp.start();
btPlaye.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
mp = MediaPlayer.create(getApplicationContext(), u);
mp.start();
}
});
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.btPlay:
//Uri u = Uri.parse(mySongs.get(position).toString());
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public class ListActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final int[] vals = { R.raw.image_1 };
ListView lv = (ListView) findViewById(R.id.listView1);
final StringArrayAdapter sa = new StringArrayAdapter(vals, this);
lv.setAdapter(sa);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
// TODO Auto-generated method stub
//startActivity(new Intent(getApplicationContext(), Player.class).putExtra("pos", position).putExtra("songList", vals[position]));
Log.i("", sa + "");
}
});
}
}
0
0
قضیه اینه وقتی با uri آهنگ رومی گیرم کرش می کنه (10 سال پیش)
برای این سوال پاسخی وجود ندارد.
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .